server/session.py
changeset 7406 e772a2c57b00
parent 7398 26695dd703d8
parent 7405 8c752d113ebb
child 7454 1090724f28ed
equal deleted inserted replaced
7402:826e5663a686 7406:e772a2c57b00
   456 
   456 
   457     # security control #########################################################
   457     # security control #########################################################
   458 
   458 
   459     DEFAULT_SECURITY = object() # evaluated to true by design
   459     DEFAULT_SECURITY = object() # evaluated to true by design
   460 
   460 
       
   461     def security_enabled(self, read=False, write=False):
       
   462         return security_enabled(self, read=read, write=write)
       
   463 
   461     def init_security(self, read, write):
   464     def init_security(self, read, write):
   462         if read is None:
   465         if read is None:
   463             oldread = None
   466             oldread = None
   464         else:
   467         else:
   465             oldread = self.set_read_security(read)
   468             oldread = self.set_read_security(read)
   563     # hooks activation control #################################################
   566     # hooks activation control #################################################
   564     # all hooks should be activated during normal execution
   567     # all hooks should be activated during normal execution
   565 
   568 
   566     HOOKS_ALLOW_ALL = object()
   569     HOOKS_ALLOW_ALL = object()
   567     HOOKS_DENY_ALL = object()
   570     HOOKS_DENY_ALL = object()
       
   571 
       
   572     def allow_all_hooks_but(self, *categories):
       
   573         return hooks_control(self, self.HOOKS_ALLOW_ALL, *categories)
       
   574     def deny_all_hooks_but(self, *categories):
       
   575         return hooks_control(self, self.HOOKS_DENY_ALL, *categories)
   568 
   576 
   569     @property
   577     @property
   570     def hooks_mode(self):
   578     def hooks_mode(self):
   571         return getattr(self._threaddata, 'hooks_mode', self.HOOKS_ALLOW_ALL)
   579         return getattr(self._threaddata, 'hooks_mode', self.HOOKS_ALLOW_ALL)
   572 
   580