[Zope-dev] Re: unregistering components?

Chris Withers chris at simplistix.co.uk
Sun Nov 25 18:41:49 EST 2007


Philipp von Weitershausen wrote:
> On 25 Nov 2007, at 13:37 , Chris Withers wrote:
>> Philipp von Weitershausen wrote:
>>>>> class IComponentRegistry(interface.Interface):
>>> I think you should use zope.component.getGlobalSiteManager() for this.
>>
>> So getGlobalSiteManager returns a component registry?
> 
> Yes. It returns the one and only global registry.

Am I right in thinking the global registry is _only_ used if no context 
is supplied?

>> If so, how come it's not called getGlobalComponentRegistry?
> 
> Because component registries used to be called site managers and we 
> can't just change the API at this point anymore.

Well, getGlobalComponentRegistry could be added as an alternate spelling 
and people could be encouraged to use it ;-)

There seems to be comments suggesting getSiteManager is deprecated, but 
maybe I'm not getting exactly what is being deprecated...

>> How do you set up nested registries? For example, if a certain area of 
>> a site should have a registry which overrides the global one, but only 
>> for that area, and should fall back on it if not adapter could be found?
> 
> You use sites. Sites are places (usually containers) in the component 
> hierarchy that have (local) component registries associated with them. 

So, by "component heirarchy" I'm guessing you really mean "object 
hierarchy" and by "Site" you mean "something implementing 
IComponentRegistry"? If I'm off base, please say...

I'm guessing the adapter to IComponentLookup is what implements the 
search up the object graph to find an IComponentRegistry? If so, where 
do I find that adapter implementation(s)?

> And yes, the name "site" is misleading, but again, we have it as legacy 
> now. How to work with sites, how to set them up, etc. is all explained 
> in my book. I'm sure you have a copy :)

I do, and I'm very greatful for it...

> (Btw, this thread has nothing to do with the development *of* Zope and 
> is therefore zope at zope.org or zope3-users at zope.org rather than 
> zope-dev at zope.org material.)

...however, I'm interested in the mechanics of how zope.component 
handles multiple component registries, in particular how registries are 
added to and removed from the set of registries that are searched hen 
looking for a component and some other bits and pieces.

In short, if the current zope.component implementation already does what 
I want, or whether I need to do work on the development *of* it it order 
to get what I'm after...

...of course, I don't know exactly what I'm after yet, but I hope you'll 
bear with my questions in the meantime ;-)

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope-Dev mailing list