Yuan HOng wrote:
If I have a utility component whose initializaiton depends on the availability of another utility, the initialization fails with a Component Lookup Error. It seems that in the ZCML file, the utility components are first created, and then at the end of the whole configuration, they are registered.
Yup.
So if in the initilization code of utility B I need to look up a utility A, the ZCML configuration will fail.
That's why you shouldn't look up any components in __init__ :)
The problem is that although the z3c eninge object is created before the 'utility' directive is executed, it is not registered and therefore can not be looked up when the 'utility' directive tries to create the MyUtility object. How does one usually solve such interdependencies?
Look up the utility when you actually *need* it. This is a general rule of thumb, because you always want to preserve the possibility of local utilities coming from some local sites, and those aren't available during some initialization code.
_______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users