[Zope-dev] more on stacked component registries

Chris Withers chris at simplistix.co.uk
Tue Jan 15 08:49:03 EST 2008


Hi All,

Happy New Year, etc :-)

Been working more on this stuff so finally have some more questions...

Philipp von Weitershausen wrote:
>> Okay, but where's this code? (ie: what .py should I look at for the 
>> local registry implementation)
> 
> zope.app.component.site contains the LocalSiteManager class. This is the 
> persistent component registry used in Zope 3's standard ISites. It 
> inherits from zope.component.persistentregistry.PersistentComponents 
> which in turn inherits from zope.component.registry.Components. The 
> latter has the dynamic __bases__ property. You'll see that the setter 
> really just sets the __bases__ on its internal adapter and utility 
> registry. Both of those (sic!) 

What does this "sic" mean?

> are some sort of subclass of 
> zope.interface.adapter.BaseAdapterRegistry which has the handling for 
> cascading lookups through its __bases__ property.

Actually, it doesn't. The handling of __bases__ appears to be done in 
the functions of the mysterious zope.interface.ro module.
(that ro thing takes the biscuit for obscure naming :-( )

Am I off base here? If so, more info please! :-)

Anyway, another question I have relates to the way in which registries 
and sub registries are stacked up. Am I right in assuming the current 
code is designed around a static setup of adapter registries which the 
deeper registries cache the results of the registries higher up?

For what I'm after, I need to have a more dynamic buildup of 
registrations based on which objects have been traversed through.

I can see two ways to approach this:

- stack the registries up during travesal in some way. I guess this
   would be a variant of what's done now with current nested registries.
   Is this feasible? Will there be performance problems?

- use one global registry and add/remove registrations during traversal 
as necessary. How fast is registration/unregistration of adapters and 
the like? How many adapter adds/removes at a traversal node would it 
take to really slow things down?

I still feeling like I'm grasping a bit here but I hope you guys can help!

cheers,

Chris

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


More information about the Zope-Dev mailing list