Monday, April 27, 2009

ATI woes after upgrade to Jaunty

After upgrading to Ubuntu 9.04, i would get a scrambled screen and a freeze after X starts. It was still possible to SSH to the machine, but it didn't react to the keyboard. I have an ATI Radeon HD2350. I had problems with earlier versions of Ubuntu, but my friend Google really didn't give me much hope. (I'll never ever buy something with an ATI card in it again!)

I found a fix here, and it consisted of installing envyng-core and running envyng -t ro remove all ati drivers. That was all i had to do to get a normal login screen.

Update: After several issues with this graphics card (system freezes, faulty colours after user switching, never works out of the box) i ditched it. I'm in nVidia heaven now.

Friday, April 24, 2009

A text-field with formatting

Sometimes, you want your text-field (meaning "field" in an Archetypes context) to preserve line breaks. I used to think this was not possible: if you want line breaks, or other formatting stuff, you'll have to use a rich text field.

However, my colleague Huub pointed out this neat way of preserving formatting in a text field:

You set the tagged values:
default_content_type=text/x-web-intelligent
allowable_content_types=python:text/x-web-intelligent
default_output_type=text/html


This will even turn e-mail addresses and urls into links.

Wednesday, April 22, 2009

Why is @@manage-portlets not available on my custom content type?

It's something to do with not extending an Archetypes class.

I had a custom type which i created which ArchGenXML, using the <<large>> stereotype in my UML. The view wasn't available on my type. When i removed the stereotype and created a generalization from (<<stub>> class) ATBTreeFolder instead (tagged value import_from = Products.ATContentTypes.content.folder), it worked.

Thursday, April 9, 2009

Creating a separate instance for debugging

Make debugging Zope/Plone more fun using a live environment!

Update: A separate config file for a two-instance setup



You may want to use the file below to create a two-instances setup from a very basic config file. In this case, my config extends dvl.cfg, which is a single-instance, non-cluster setup. It's important that this buildout have an [instance] section. (Almost all simple buildouts, notably those created by paster, do.)

Contents of dvl-debug.cfg:

# Development setup with separate instance for debugging

[buildout]
extends = dvl.cfg

parts +=
zeoserver
debug-instance

[zeoserver]
recipe = plone.recipe.zope2zeoserver
zope2-location = ${zope2:location}
zeo-address = 127.0.0.1:8000

[instance]
recipe = collective.recipe.zope2cluster
instance-clone = instance
zeo-client = true
zeo-address = ${zeoserver:zeo-address}

[debug-instance]
recipe = collective.recipe.zope2cluster
instance-clone = instance
http-address = 8081


Original post



I recently modified my buildout-dvl.config to read
[buildout]
# I have some base configuration in another file
extends = buildout-base.cfg

eggs +=
plone.reload
Products.DocFinderTab

parts +=
zeoserver
instance0
instance1

[zeoserver]
recipe = plone.recipe.zope2zeoserver
zope2-location = ${instance-settings:zope2-location}
zeo-address = ${instance-settings:zeo-address}

[instance-settings]
# Most instance-settings are defined in my buildout-base.cfg
zeo-address = 127.0.0.101:8000

[instance0]
# My development instance
recipe = collective.recipe.zope2cluster
instance-clone = instance-settings
http-address = 5432

debug-mode = on
verbose-security = on

zcml =
plone.reload

[instance1]
# My debugging instance
recipe = collective.recipe.zope2cluster
instance-clone = instance-settings
http-address = 8101

Where buildout-base.cfg contains, among other things:
[instance-settings]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
user = zope-prd:secret
effective-user = zope-prd
zeo-client = True
zeo-address = 192.168.62.39:8000

Just fire up your debugging instance: ./bin/instance1 debug. Change something, using only Python code, save it by doing import transaction; transaction.commit() and watch your changes take effect in your live environment.