# HG changeset patch # User Pierre-Yves David # Date 1364557624 -3600 # Node ID bd5b5759c9b3245161071c1bd89b47a0e5f13d80 # Parent 8a57802d40d328154e94ecb3bc1c122515dbf3d3 [session] make hook_control API private The doc already says "internal API". The old entry point is now officially deprecated and the context manager have been made private. diff -r 8a57802d40d3 -r bd5b5759c9b3 server/session.py --- a/server/session.py Tue Mar 12 18:31:15 2013 +0100 +++ b/server/session.py Fri Mar 29 12:47:04 2013 +0100 @@ -87,8 +87,11 @@ else: self.session.commit(free_cnxset=self.free_cnxset) +@deprecated('[3.17] use .allow/deny_all_hooks_but instead') +def hooks_control(obj, *args, **kwargs): + return obj.hooks_control(*args, **kwargs) -class hooks_control(object): +class _hooks_control(object): """context manager to control activated hooks categories. If mode is session.`HOOKS_DENY_ALL`, given hooks categories will @@ -99,10 +102,10 @@ .. sourcecode:: python - with hooks_control(self.session, self.session.HOOKS_ALLOW_ALL, 'integrity'): + with _hooks_control(self.session, self.session.HOOKS_ALLOW_ALL, 'integrity'): # ... do stuff with all but 'integrity' hooks activated - with hooks_control(self.session, self.session.HOOKS_DENY_ALL, 'integrity'): + with _hooks_control(self.session, self.session.HOOKS_DENY_ALL, 'integrity'): # ... do stuff with none but 'integrity' hooks activated This is an internal api, you should rather use @@ -996,9 +999,9 @@ # all hooks should be activated during normal execution def allow_all_hooks_but(self, *categories): - return hooks_control(self, HOOKS_ALLOW_ALL, *categories) + return _hooks_control(self, HOOKS_ALLOW_ALL, *categories) def deny_all_hooks_but(self, *categories): - return hooks_control(self, HOOKS_DENY_ALL, *categories) + return _hooks_control(self, HOOKS_DENY_ALL, *categories) hooks_mode = tx_attr('hooks_mode')