by Ross Patterson last modified 2009-08-23T17:56:45+02:00
GenericSetup import hadlers ala ZCML directive handlers

I've gotten so far behind on my blogging, I think it's time to admit that I'm not behind, I've simply stopped. :) In the hopes that I start up again, I'd like to write a bit about something I wrote a while ago and still use today: GSML.

The amount of code duplication involved in writing a properly declaritive GenericSetup import/export handler has always bothered me. It seems like most of the duplication involves fairly manually walking the XML DOM to extract the data needed. I find this to be very tedious and error prone. I think implementing GS import/export handlers should have nothing to do with XML.

ZCML does a great job of allowing directive handlers to be simple Python functions that know nothing of XML. I wrote GSML to bring that separation of concerns to GS import handlers so I could stop writing DOM walkers.

Currently, GSML lives in collective.gsqi which is just my grab bag of patches to GS and portal_quickinstaller I use in my client work. Here's a doctest that covers writing an import handler with GSML. Here's are a groups import handler and a references import handler implemented with GSML.

The current implementation of GSML just wraps the ZCML configuration engine sufficiently to use it for GS import handlers. Since ZCML has never concerned itself with writing ZCML, however, GSML currently includes no support for export handlers. This is obviously the most important TODO.

So please try it out, take a look at it and let me know what you think. In particular, if anyone out there has any interest in the export stuff, either in contributing to it, sprinting on it, advising on it, or anything else, I'd really like to hear from you.