[Zope-CMF] Re: Tools as local utilities

Hanno Schlichting plone at hannosch.info
Thu Feb 8 21:57:46 EST 2007


Tres Seaver wrote:
> Martin Aspeli wrote:
>> Jens Vagelpohl wrote:
> 
>>> All those who think this is somehow impure and dirty, keep in mind  
>>> that this arrangement won't be forever, only for the 2.1 branch.  
>>> Afterwards there's more time to plan on packaging things differently.
>> The only thing that worries me is that if we artificially inject it into 
>> Products.* and then want to move it, we'll have module aliases to 
>> contend with.
> 
> Shouldn't need them, unless we are somehow createing persistent objects
> from that package / product.  I thought all that stuff happened at
> runtime, with no persistence?

The local registry we are already using is persistent, so will be the
new registry, where the main difference is that the new one is smarter
about handling nested local registries and Acquisition wrapped
utilities. The current code looks something like this:

from zope.component.globalregistry import base
from zope.component.persistentregistry import PersistentComponents

from Products.Five.component import enableSite
from Products.Five.component.interfaces import IObjectManagerSite

def enableSite(self, portal):
    enableSite(portal, iface=IObjectManagerSite)

    components = PersistentComponents()
    components.__bases__ = (base,)
    portal.setSiteManager(components)


where setSiteManager is part of OFS.ObjectManager and defined as:

def setSiteManager(self, components):
    self._components = components

We wouldn't need a GenericSetup exportimport handler for the component
registry when the information wouldn't be persistent.

Hanno



More information about the Zope-CMF mailing list