Stacking zope.component registries

Martin Aspeli <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
Hi,

I'd like to come up with a way to set up a test fixture that does the 
component registry equivalent of stackable DemoStorage's: whilst a layer 
is in effect, calls to provideAdapter() and friends (and ZCML execution) 
go into a global registry that is stacked on top of the default global one.

On layer tear-down, the registry is popped, leaving the original (or 
previous) global registry intact.

In zope.component.globalregistry, I see:

def provideUtility(component, provides=None, name=u''):
     base.registerUtility(component, provides, name, event=False)

base is a module-level variable of type BaseGlobalComponents(). I guess 
there'd be a way to use __bases__ to create this kind of stack, but I'm 
not clear on the details, and in particular whether this would really 
work with provideAdapter() and the rest of the (test-oriented) Python API.

Martin

_______________________________________________
Zope-Dev maillist  -  [email protected]
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 )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.