On Fri, Feb 18, 2011 at 3:44 PM, Daniel Holth <[email protected]> wrote:
> If you want to use the global ZCA then you should call > Configurator.hook_zca. See > http://docs.pylonsproject.org/projects/pyramid/dev/api/config.html#pyramid.config.Configurator.hook_zca > > Global ZCA means calls to > > zope.component.getUtility(ISomething) > > instead of > > request.registry.getUtility(ISomething) My understanding from the docs is that it's a bit more complicated than that. I thought calling hook.zca() makes the global zope utility *commands* get the Pyramid registry, or rather whatever registry you setup using the Configurator. IE if you then use getUtility() you get something from that registry. I believe that this does not necessarily mean the same thing as passing the zope registry obtained by using getGlobalSiteManager to your configurator. If, for example, you had some other non-pyramid component using the ZCA, perhaps something that got called first in a WSGI chain, and you wanted to make sure that pyramid gets *that* registry, you can get that registry using zope.component.getGlobalSiteManager() and you will get the same registry. According to my understanding, this does *not* happen just because you call hook zca, you would wind up with two different registries. If you want to make sure you are using the global registry, you can always use all the same registry commands as attributes of the global registry. IE # get the global registry, will be the same as pyramid IFF # you passed this into Configurator at startup gsm = getGlobalSiteManager() # use methods to get utilities etc gsm.getUtility( IFoo, 'foo') I could verify this with code if it's helpful, but I'm thinking Chris M or other zope experts can verify it at a glance. HTH iain -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.
