* 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
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
if context is None:
if base is None:
from zope.component.globalregistry import base
# Use the global site manager to adapt context to `IComponentLookup`
# to avoid the recursion implied by using a local `getAdapter()`
except TypeError, error:
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).
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -