> Betreff: Re: [Zope-dev] zope.component.zcml and global registry
> Hello roger,
> * 2010-03-03 11:36, Roger wrote:
> > Not sure if I understand you correct. But what do you think
> about the
> > following:
> > - implement a new optional attribute useLocal=True
> > in the directive and then configure the directive action
> > and make use of the (local) getSiteManager method.
> > I like to use getGlobalSiteManager by default because this doesn't
> > force a database access and load the local site manager if
> the site is
> > a local site.
> I'm not sure what you mean with "doesn't force a database
> access and load the local site manager". This is the
> implementation of getSiteManager from
> base = None
> def getSiteManager(context=None):
> global base
> if context is None:
> if base is None:
> from zope.component.globalregistry import base
> return base
> # Use the global site manager to adapt context to
> # to avoid the recursion implied by using a local
> `getAdapter()` call.
> return IComponentLookup(context)
> except TypeError, error:
> raise ComponentLookupError(*error.args)
> In our use cases (ZCML registrations), context is None and
> thus it will simply return the global registry, without any
> database access. It is the equivalent of
> getGlobalSiteManager, but it can be hooked (note the
> @hookable decorator).
> > Could this be an alternative concept and fit?
> This would change the API, my proposed change is
> back-compatible and does not introduce any new API (because
> it is equivalent, indeed).
Uhh, I didn't understand your question correct.
I was thinking that the getGlobalSiteManager should
lookup the local registry. Sorry about that.
> Best regards,
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -