Wednesday, August 16

We are getting local...

As you may have noticed Plone developers are currently pushing hard to use new Zope3 technologies to bring sanity again to the world of Plone code.

So far we have been using interfaces and browser views in Plone 2.5, but for Plone 3.0 we are going to rely on Zope 2.10 which has a far easier local component story. So you can expect to see not only global utilities and adapters but also their local counterparts.

But how do we actually create those in our persistent CMF-based portals? Well, why not do the obvious and use our existing configuration setup called GenericSetup to create them for us?

Imagine a simple file called sitemanager.xml with the following code:
< ?xml version="1.0"? >
< utilities >
< utility
interface="plone.app.i18n.locales.interfaces.ICountries"
class="plone.app.i18n.locales.countries.Countries"
/>
< /utilities >
Wouldn't it be nice if you could use something like it? Well you can, I made the first prototype as part of my Google Summer of Code project and it's working just fine.

You can take a sneak peak at the code at: http://dev.plone.org/collective/browser/GSLocalAddons/trunk/exportimport/sitemanager.py. Once this has a decent amount of tests, I would consider this a valuable addition to GenericSetup itself.

P.S. I should note that I stole some ideas from Lennart Regebro's work on CPSSharedCalendar, thx mate ;)

3 comments:

philiKON said...

Way to go, Hanno! I think this is a great idea. I have a few comments on the code (after skimming over it) and also think this might be useful outside Plone or even the CMF...

Are you coming to Seattle? I feel like a sprint is needed for local components in Zope 2... Utilities, adapters, views... we all want'em!

alecm said...

Very nice work. This is something well worth having in GS.

Hanno Schlichting said...

Just a short update, the handler has been moved to the collective at http://dev.plone.org/collective/browser/GSLocalAddons/trunk and been placed under the ZPL license, so there's no reason why you shouldn't be able to start helping on finishing it yourself ;) But of course I'm also interested in all comments, just drop a line or post here.