server/session.py
changeset 8813 cf94a7f980fe
parent 8812 52af67a2f0a5
child 8814 37fd037c0526
equal deleted inserted replaced
8812:52af67a2f0a5 8813:cf94a7f980fe
   988     def deny_all_hooks_but(self, *categories):
   988     def deny_all_hooks_but(self, *categories):
   989         return hooks_control(self, HOOKS_DENY_ALL, *categories)
   989         return hooks_control(self, HOOKS_DENY_ALL, *categories)
   990 
   990 
   991     hooks_mode = tx_attr('hooks_mode')
   991     hooks_mode = tx_attr('hooks_mode')
   992 
   992 
   993     def set_hooks_mode(self, mode):
   993     def init_hooks_mode_categories(self, mode, categories):
   994         assert mode is HOOKS_ALLOW_ALL or mode is HOOKS_DENY_ALL
   994         assert mode is HOOKS_ALLOW_ALL or mode is HOOKS_DENY_ALL
   995         oldmode = self._tx.hooks_mode
   995         oldmode = self._tx.hooks_mode
   996         self._tx.hooks_mode = mode
   996         self._tx.hooks_mode = mode
   997         return oldmode
       
   998 
       
   999     def init_hooks_mode_categories(self, mode, categories):
       
  1000         oldmode = self.set_hooks_mode(mode)
       
  1001         if mode is self.HOOKS_DENY_ALL:
   997         if mode is self.HOOKS_DENY_ALL:
  1002             changes = self.enable_hook_categories(*categories)
   998             changes = self.enable_hook_categories(*categories)
  1003         else:
   999         else:
  1004             changes = self.disable_hook_categories(*categories)
  1000             changes = self.disable_hook_categories(*categories)
  1005         self._tx.ctx_count += 1
  1001         self._tx.ctx_count += 1
  1016                     if mode is self.HOOKS_DENY_ALL:
  1012                     if mode is self.HOOKS_DENY_ALL:
  1017                         return self.disable_hook_categories(*categories)
  1013                         return self.disable_hook_categories(*categories)
  1018                     else:
  1014                     else:
  1019                         return self.enable_hook_categories(*categories)
  1015                         return self.enable_hook_categories(*categories)
  1020             finally:
  1016             finally:
  1021                 self.set_hooks_mode(oldmode)
  1017                 self._tx.hooks_mode = oldmode
  1022 
  1018 
  1023     disabled_hook_categories = tx_attr('disabled_hook_cats')
  1019     disabled_hook_categories = tx_attr('disabled_hook_cats')
  1024     enabled_hook_categories = tx_attr('enabled_hook_cats')
  1020     enabled_hook_categories = tx_attr('enabled_hook_cats')
  1025     disable_hook_categories = tx_meth('disable_hook_categories')
  1021     disable_hook_categories = tx_meth('disable_hook_categories')
  1026     enable_hook_categories = tx_meth('enable_hook_categories')
  1022     enable_hook_categories = tx_meth('enable_hook_categories')