[Zope3-Users] Executing utility specific code on server startup

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Nov 12 07:21:25 EST 2005


On Saturday 22 October 2005 13:01, Chris Lehmann wrote:
> I have a utility that needs to start several threads when zope starts
> up.  What is the best way to accomplish this?
>
> So far I have tried to use the IDatabaseOpenedWithRoot and
> IProcessStarting events but when I try and register them with the
> following code, my handlers do not get called.  Code from the
> constructor of my utility class:
>
> zapi.getGlobalSiteManager().subscribe([IProcessStartingEvent],None,
> self.onStartup)
>
> What am I doing wrong?

You need to make this registration using ZCML. Having this code in the utility 
constructor is far too late.

<subscriber
    for="...IProcessStartingEvent"
    handler="...onStartup" />

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


More information about the Zope3-users mailing list