I'm trying to implement a global utility that makes use of other
global utilities when it is created. In other words, the __init__ of
my utility class, tries to get to other utilities.
This does not work however, as the utilities I'd like to get are not
registered yet when my own utility is created - even if I made sure
the registrations for the other utilities would've been performed
before "my" utility is registered.
I tried to find the reason and I think I found it: when the zcml
directive for a utility is read, an action object is created. Somewhat
later in the configuration process these action objects are executed
and the actual utility registration takes place.
It is when the action object is created that "my" utility is
instantiated. And of course, no other actual registrations were made
yet at that point, because no actions have been executed yet, so not
utilities are available to make use of.
Is there a way to overcome this? (or to put it differently, why is
"my" utility created when the action object is created and not just
before the actual registration?)
Zope3-users mailing list