Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from pyramid.threadlocal import get_current_registry 

2 

3 

4class ZCAConfiguratorMixin(object): 

5 def hook_zca(self): 

6 """ Call :func:`zope.component.getSiteManager.sethook` with the 

7 argument :data:`pyramid.threadlocal.get_current_registry`, causing 

8 the :term:`Zope Component Architecture` 'global' APIs such as 

9 :func:`zope.component.getSiteManager`, 

10 :func:`zope.component.getAdapter` and others to use the 

11 :app:`Pyramid` :term:`application registry` rather than the Zope 

12 'global' registry.""" 

13 from zope.component import getSiteManager 

14 

15 getSiteManager.sethook(get_current_registry) 

16 

17 def unhook_zca(self): 

18 """ Call :func:`zope.component.getSiteManager.reset` to undo the 

19 action of :meth:`pyramid.config.Configurator.hook_zca`.""" 

20 from zope.component import getSiteManager 

21 

22 getSiteManager.reset()