[Zope] Dependent ZCA utility registration ?

Peter Sabaini peter at sabaini.at
Wed May 12 04:45:23 EDT 2010


I have trouble registering utilities which depend on the presence of
other utilities; eg. I have a package A where I want to register utility
B which depends on registration of utility C. 

I tried to register B by putting registration in the __init__.py of A,
which fails because at import time C is not yet registered. 

Registration by subscribing to the utility registration event handler
for C also failed, because by the time the handler gets called, the
utility C is not yet installed. 

My current workaround involves registration upon the IDatabaseOpen
event, which is doubly ugly because Zope 2.10 doesnt send that event out
of the box -- I send it in a monkey-patched Zope2.App.startup module.  

What is the canonical way to do this?

Thanks, 
peter.



More information about the Zope mailing list