server/session.py
changeset 7387 d240cff2d8ba
parent 7352 d68f9319bfda
child 7398 26695dd703d8
--- a/server/session.py	Mon May 16 11:36:42 2011 +0200
+++ b/server/session.py	Thu Apr 28 17:05:22 2011 +0200
@@ -553,6 +553,7 @@
         - on HOOKS_ALLOW_ALL mode, ensure those categories are disabled
         """
         changes = set()
+        self.pruned_hooks_cache.clear()
         if self.hooks_mode is self.HOOKS_DENY_ALL:
             enabledcats = self.enabled_hook_categories
             for category in categories:
@@ -574,6 +575,7 @@
         - on HOOKS_ALLOW_ALL mode, ensure those categories are not disabled
         """
         changes = set()
+        self.pruned_hooks_cache.clear()
         if self.hooks_mode is self.HOOKS_DENY_ALL:
             enabledcats = self.enabled_hook_categories
             for category in categories:
@@ -807,7 +809,8 @@
 
     def _clear_tx_storage(self, txstore):
         for name in ('commit_state', 'transaction_data',
-                     'pending_operations', '_rewriter'):
+                     'pending_operations', '_rewriter',
+                     'pruned_hooks_cache'):
             try:
                 delattr(txstore, name)
             except AttributeError:
@@ -958,6 +961,14 @@
             self._threaddata.pending_operations = []
             return self._threaddata.pending_operations
 
+    @property
+    def pruned_hooks_cache(self):
+        try:
+            return self._threaddata.pruned_hooks_cache
+        except AttributeError:
+            self._threaddata.pruned_hooks_cache = {}
+            return self._threaddata.pruned_hooks_cache
+
     def add_operation(self, operation, index=None):
         """add an observer"""
         assert self.commit_state != 'commit'