Coverage for /home/martinb/.local/share/virtualenvs/camcops/lib/python3.6/site-packages/pyramid/config/zca.py : 50%

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
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
15 getSiteManager.sethook(get_current_registry)
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
22 getSiteManager.reset()