server/session.py
changeset 6147 95c604ec89bf
parent 6142 8bc6eac1fac1
child 6401 d7f5d873e1b8
equal deleted inserted replaced
6146:f3d82f25ab61 6147:95c604ec89bf
    62     If mode is session.`HOOKS_DENY_ALL`, given hooks categories will
    62     If mode is session.`HOOKS_DENY_ALL`, given hooks categories will
    63     be enabled.
    63     be enabled.
    64 
    64 
    65     If mode is session.`HOOKS_ALLOW_ALL`, given hooks categories will
    65     If mode is session.`HOOKS_ALLOW_ALL`, given hooks categories will
    66     be disabled.
    66     be disabled.
       
    67 
       
    68     .. sourcecode:: python
       
    69 
       
    70        with hooks_control(self.session, self.session.HOOKS_ALLOW_ALL, 'integrity'):
       
    71            # ... do stuff with all but 'integrity' hooks activated
       
    72 
       
    73        with hooks_control(self.session, self.session.HOOKS_DENY_ALL, 'integrity'):
       
    74            # ... do stuff with none but 'integrity' hooks activated
    67     """
    75     """
    68     def __init__(self, session, mode, *categories):
    76     def __init__(self, session, mode, *categories):
    69         self.session = session
    77         self.session = session
    70         self.mode = mode
    78         self.mode = mode
    71         self.categories = categories
    79         self.categories = categories