Hi Fabio
Betreff: [Zope-dev] zope.component.zcml and global registry
Hi folks,
the ZCML directives in zope.component register components using the utility method handler, which looks like:
def handler(methodName, *args, **kwargs): method = getattr(zope.component.getGlobalSiteManager(), methodName)
In our company-specific framework (which is far far from zope3, and only uses the bicycle repair kit), we use different registries per application, similarly to repoze.bfg.
Everything works, included code which relies on the zope.component's API, thanks to the hooks on getSiteManager. Those ZCML directives use the getGlobalSiteManager though, which is not hookable and thus we had to reimplement the ZCML directives we need to call getSiteManager instead of getGlobalSiteManager.
By default, getSiteManager returns the global registry, so I don't see any obvious reason why the ZCML directives make use of getGlobalSiteManager. repoze.bfg, for example, reimplemented the ZCML directives as we did, but I'd love to be able to use the implementation from zope.component.
Any idea? Would you kill me if I propose to change the registration handler to use getSiteManager instead? :)
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. My personal goal is to avoid any Zope database access which is not really needed. Because we use MongoDB as object storage and we only have a few items in the Zope database. Things like a local component registry get only rarly used and loaded in our setup. Could this be an alternative concept and fit? Regards Roger Ineichen
Thanks, Fabio _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )