Hi, In our project we have a supervisor-utility (started first by zcml..) and some other utilities which creation is logged to this utilitiy.
hope, this helps tschuess, Markus ------------------------------ def bootStrapSubscriberDatabase(event): """initialisation of cron utility on first database startup """ dummy_db, connection, dummy_root, root_folder = \ getInformationFromEvent(event) madeIkAdmUtilCron = ensureUtility( root_folder, IIkAdmUtilCron, 'IkAdmUtilCron', IkAdmUtilCron, '', copy_to_zlog=False, asObject=True) if isinstance(madeIkAdmUtilCron, IkAdmUtilCron): logger.info( u"bootstrap: Ensure named IkAdmUtilCron") dcore = IWriteZopeDublinCore(madeIkAdmUtilCron) dcore.title = u"IKOMtrol Timer" dcore.created = datetime.now(berlinTZ) sitem = root_folder.getSiteManager() utils = [ util for util in sitem.registeredUtilities() if util.provided.isOrExtends(IIkAdmUtilSupervisor)] instIkAdmUtilSupervisor = utils[0].component instIkAdmUtilSupervisor.appendEventHistory( \ u" bootstrap: made IIkAdmUtilCron-Utility") recursiveCronSubscriber( root_folder) transaction.get().commit() connection.close() ------------------------------ Am Dienstag, 19. Juni 2007 15:53 schrieb Jan-Wijbrand Kolman: > Hi, > > > 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?) > > > kind regards, > jw > _______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users