server/session.py
changeset 9025 768eb9a6a2db
parent 9024 701b19785f1d
child 9026 84c5b01ebb3e
equal deleted inserted replaced
9024:701b19785f1d 9025:768eb9a6a2db
    97 
    97 
    98 
    98 
    99 class _hooks_control(object):
    99 class _hooks_control(object):
   100     """context manager to control activated hooks categories.
   100     """context manager to control activated hooks categories.
   101 
   101 
   102     If mode is session.`HOOKS_DENY_ALL`, given hooks categories will
   102     If mode is`HOOKS_DENY_ALL`, given hooks categories will
   103     be enabled.
   103     be enabled.
   104 
   104 
   105     If mode is session.`HOOKS_ALLOW_ALL`, given hooks categories will
   105     If mode is `HOOKS_ALLOW_ALL`, given hooks categories will
   106     be disabled.
   106     be disabled.
   107 
   107 
   108     .. sourcecode:: python
   108     .. sourcecode:: python
   109 
   109 
   110        with _hooks_control(self.session, self.session.HOOKS_ALLOW_ALL, 'integrity'):
   110        with _hooks_control(cnx, HOOKS_ALLOW_ALL, 'integrity'):
   111            # ... do stuff with all but 'integrity' hooks activated
   111            # ... do stuff with all but 'integrity' hooks activated
   112 
   112 
   113        with _hooks_control(self.session, self.session.HOOKS_DENY_ALL, 'integrity'):
   113        with _hooks_control(cnx, HOOKS_DENY_ALL, 'integrity'):
   114            # ... do stuff with none but 'integrity' hooks activated
   114            # ... do stuff with none but 'integrity' hooks activated
   115 
   115 
   116     This is an internal api, you should rather use
   116     This is an internal api, you should rather use
   117     :meth:`~cubicweb.server.session.Session.deny_all_hooks_but` or
   117     :meth:`~cubicweb.server.session.Session.deny_all_hooks_but` or
   118     :meth:`~cubicweb.server.session.Session.allow_all_hooks_but` session
   118     :meth:`~cubicweb.server.session.Session.allow_all_hooks_but` session