On Wednesday 20 June 2007 10:43, Hermann Himmelbauer wrote:
> How did you do that? I managed it the following way:
> -------------- snip ---------------
> from zope.app.appsetup.interfaces import IDatabaseOpenedWithRootEvent
> from zope.app.appsetup.bootstrap import getInformationFromEvent
> @adapter(IDatabaseOpenedWithRootEvent)
> def addFoobar(event):
>     db, connection, root, root_folder = getInformationFromEvent(event)
>     if 'swarmfinder' not in root_folder:
>         root_folder['foobar'] = Foobar()
> ------------- snip ----------------
> What I dislike here is that there that I use the
> function "getInformationFromEvent", which is already called in the function
> where in the event is triggered; Especially it does a "database.open()",
> which is maybe not a good idea as the database is already opened.
> Is there a cleaner way

Yeah, people at ZC prefer using generations. Others (including me), on the 
other hand, have developed z3c.configurator and z3c.sampledata, which can 
setup entire applications for you.

Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
Zope3-users mailing list

Reply via email to