[Zope-dev] zope.component.zcml and global registry

Fabio Tranchitella kobold at kobold.it
Wed Mar 3 04:48:10 EST 2010


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? :)

Thanks,
Fabio


More information about the Zope-Dev mailing list