# HG changeset patch # User Pierre-Yves David # Date 1366810429 -7200 # Node ID c5c6da8e42db7c3f66848741202f7dd7aff85534 # Parent da2007002dca99c6d1cdff7dea51f956c8182d5d [session] fix hooks_control backward compat Session object have no ``hooks_control`` control method. it has ``allow_all_hooks_but`` and ``deny_all_hooks_but`` ones. Regression introduced in bd5b5759c9b3. diff -r da2007002dca -r c5c6da8e42db server/session.py --- a/server/session.py Wed Apr 24 12:10:12 2013 +0200 +++ b/server/session.py Wed Apr 24 15:33:49 2013 +0200 @@ -88,8 +88,13 @@ 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) +def hooks_control(obj, mode, *categories): + assert mode in (HOOKS_ALLOW_ALL, HOOKS_DENY_ALL) + if mode == HOOKS_ALLOW_ALL: + return obj.allow_all_hooks_but(*categories) + elif mode == HOOKS_DENY_ALL: + return obj.deny_all_hooks_but(*categories) + class _hooks_control(object): """context manager to control activated hooks categories.