[Zope-CMF] ZCML import/export step registration

Wichert Akkerman wichert at wiggy.net
Tue Oct 30 05:05:55 EDT 2007


I completed implementation of zcml-based import and export step
registration on the wichert-zcml-steps branch. The syntax for import
steps is this:

 <genericsetup:importStep
     name="name"
     title="title"
     description="description"
     handler="Products.GenericSetup.tests.test_zcml.dummy_importstep_handler"
     version="version">
    <depends name="something.else"/>
  </genericsetup:importStep>

and for export steps:
 
 <genericsetup:exportStep
     name="name"
     title="title"
     description="description"
     handler="Products.GenericSetup.tests.test_zcml.dummy_exportstep_handler"
     />
 
steps registered using zcml are stored in a new registry. I added some
utility methods to the setup tool that look in both this registry and
the in-tool registry so all the standard machinery and ZMI interfaces
see all steps.

Exporting only exports steps from the in-tool registries.

There are several advantages to managing steps in this method:

- if a product is removed its steps no longer stick in the system, which
  could lead to errors (it was breaking sites badly until we changed GS
  to ignore steps with invalid handlers) and adds a lot of unremoveable
  entries in its ZMI pages.

- even though steps are only loaded into the registry when a profile was
  selected the way we have managed the step registration in the user
  interface and API so far this has always been a silent and trivial to
  trigger action. This lead to confusing behaviour: steps would appear
  to be registered randomly depending on which profiles a user happened
  to have accessed. With zcml registration the behaviour is simple and
  predictable: if you install a product and load its zcml its
  functionality becomes available. Since import steps have always needed
  to check for presence of XML or marker files this is harmless.
  Exporting should always be a safe operation.

- If we deprecate profile-based registration and eventually remove it
  we can simplify a lot of code.

I intend to merge this branch into trunk next week.

Wichert.

-- 
Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.


More information about the Zope-CMF mailing list