[Zope3-dev] Component install script

Jim Fulton jim at zope.com
Thu Mar 17 10:52:29 EST 2005


Stephan Richter wrote:
> On Thursday 17 March 2005 10:14, Julien Anguenot wrote:
> 
>>What whould be the proper mecanism for a zope3 component installation
>>script ? (like the external methods we are using with the CMF)
>>
>>Registering a subscriber on the IDataBaseOpenedEvent seems a little bit
>>violent to me ;);)
> 
> 
> Subscribing to IDataBaseOpenedEvent is exactely the right thing to do. The 
> reason the event is there is to use it :-)

Actually, we've discovered that that's not the right thing to do.

If you *do* go this route, you should subscribe to a
IDatabaseOpenedWithRootEvent so that you know that the root
object has already been created and so that you don't rely
on event ordering.

The better way to do this is to define a generations schema manager with
an installation script. That way, you can also update your installation
in a controlled way.

See: http://svn.zope.org/Zope3/trunk/src/zope/app/generations/README.txt?view=markup

This all assumes that you want the installation done globally.

If you want installation for each site, then it would probably be better
to install event subscribers for adding sites.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list