[Zope3-dev] Re: registerUtility(component, interface) vs provideUtility(interface, component) vs provideUtility(component, interface)

Philipp von Weitershausen philipp at weitershausen.de
Sat Sep 2 12:00:20 EDT 2006


Christian Theune wrote:
>>> Isn't the global site manager something else then zope.component?
>> No. The global site manager (we prefer to call it global component
>> registry nowadays) is defined in zope.component. It is always htere.
>>
>>> Because zope.component uses the current thread-local site-manager,
>>> depending on what was set during traversal etc., isn't it?
>> Nope. zope.component knows nothing about thread-local site managers.
>> That's zope.app.component (which hooks its knowledge of thread-local
>> site managers into zope.component).
> 
> So why does zope.component.getUtility return local utilities then?

Lol, do I have to write everything twice?

Last sentence, in the parentheses:

   "zope.app.component hooks its knowledge of thread-local site managers
   into zope.component"

Basically, look at zope.app.component.hooks, especially setHooks. Unless 
setHooks is actually executed, zope.component knows NOTHING about local 
utilities.

Philipp


More information about the Zope3-dev mailing list