Thursday, January 28, 2010

Translations in i18n folder not picked up

I had translations in an 'i18n' folder, but they didn't work. No '.mo' file was created on Zope startup, and the products wasn't listed in the ZMI's product listing.

In order to get the 'i18n' folder to be picked up, i put a <five:registerPackage package="." /> statement in configure.zcml.

Tuesday, January 26, 2010

Indexing of content created by Generic Setup

Just adding a 'profiles/default/structure' to your site will add content, but it won't be indexed properly. You'll have to manually upgrade the portal catalog. To fix this, add this to 'configure.zcml':

title="Update catalog"
description="After creating content (from profiles/default/structure), the catalog needs to be updated."
<depends name="content"/>

This is the preferred way to define dependencies for import profiles: The import step declares its dependency on the content import step. content is the name for the step which creates content from profiles/default/structure.

You could then add a method which updates the catalog in the product's
def updateCatalog(context, clear=True):
portal = context.getSite()
logger = context.getLogger('my.policy updateCatalog')'Updating catalog (with clear=%s) so items in profiles/default/structure are indexed...' % clear )
catalog = portal.portal_catalog
err = catalog.refreshCatalog(clear=clear)
if not err:'...done.')
logger.warn('Could not update catalog.')

Friday, January 22, 2010

using a policy product to install (not just get) add-ons

We all know how you can use a policy product to automatically get add-on
products and do basic site configuration. If you don't look here: and

But how to actually install these products and configure them when the policy
product is installed?

Use case: I'd like to create a policy egg that will not only download but also
install a custom theme, Products.LinguaPlone and Products.Collage. (Afterwards i want to set up LinguaPlone's available languages, and perhaps I'd also like to create translations for content that was added in the policy product's 'profiles/default/structure', but that's a different story.)

In your profiles/default/metadata, add dependencies:

Note that the name of the GS profile is defined in the product, so it could be anything. Look for the genericsetup:registerProfile's name attribute.

Alternatively, you could call the quickinstaller's installProducts method from
    quickinstaller = portal.portal_quickinstaller
installable_products = [
for product_name in installable_products:

, but that will also make products show up twice in Plone's add-on products panel. For mere products installation i would recommend the above method.

Error: "Couldn't find index page for"

When running a Plone buildout, i got: "Couldn't find index page for {package}". Turns out i'd "deactivated" it via mr.developer. Use ./bin/develop activate {package} to turn it on again.

Monday, January 18, 2010

Noorderslag 2010

I'm late with this. After skipping the second day of Eurosonic, i saw:

  • Tim Knol (singer/songwriter, too sweet but with the band it was okay)

  • Awkward I (yes again, same as last year. better atmosphere, more sound, more talking, which is good.)

  • Lola Kite (electro-punk-thingy)

  • Wende (Evening's winner. Perhaps too many English songs from the new English album.)

  • Charlene (Singer. Didn't impress me, but then again, the whole Beyoncé thing isn't up my alley.)

And much more, because there'e music everywhere, there's no escape.

Friday, January 15, 2010

Eurosonic 2010 day 1

I don't personal-blog much anymore, but i want to remember that last night, i saw:

  • Wadruna (Norwegian Role Playing Gamers with deep voices and sound effects)

  • Leisure Society (Too soft, people complained we talked too loud. In the Spieghel!)

  • Pony the Pirate (Energetic folk rock circus, evening's winner)

  • Cosmic Carnival (70's rock/bluesrock and reggae)

  • Dret & Krulle (hiphop, what were they doing?)

  • Le Roi mort et les Lentilles Rouges (Gogol Bordello goes Aznavour)

  • Heike has the giggles (Trio with girl on vocals+guitar)

Sunday, January 10, 2010

mr.developer SyntaxError "finally"

Got this error:
  File "/home/kees/.buildout/eggs/mr.developer-1.8-py2.4.egg/mr/developer/", line 109
SyntaxError: invalid syntax

Turns out 1.8 is currently unreleased, perhaps that's the reason.
Fixed it by specifying mr.developer = 1.7 in my buildout.cfg.

Friday, January 8, 2010

Testing the layout for python egg's README.txt file

Before uploading an egg, i like to test the layout of the egg to see if it is correct ReST, so it shows up nicely on the page and

$ python --long-description | rst2html > description.html

This is assuming that you create the long-description in your by reading the README.txt. My usually contains something like this:
version = '1.0'

description="Some description about what this does, who might use it etc.",
open(os.path.join("docs", "NEWS.txt")).read(),
open(os.path.join("docs", "TODO.txt")).read(),

The "\n\n".join() bit is used to make sure there's enough separation between chapters (from the various files), because otherwise you could remove a line which would result in invalid ReST.

Thursday, January 7, 2010

What is a good WYSIWYG HTML editor?

Tried vi(m), gedit, bluefish, and the winner is:!

To disable inline style statements, modify Tools > Options > Load/Save > HTML Compatibilty > set "Export" to "HTML 3.2".