server/session.py
branchstable
changeset 7757 5b3584c5a7c3
parent 7730 8d0edec31aaf
child 7769 8af09eeee130
child 7780 a1d5365fefc1
--- a/server/session.py	Mon Sep 05 16:48:37 2011 +0200
+++ b/server/session.py	Tue Sep 06 11:59:21 2011 +0200
@@ -636,12 +636,14 @@
         if txstore.ctx_count == 0:
             self._clear_thread_storage(txstore)
         else:
-            if categories:
-                if mode is self.HOOKS_DENY_ALL:
-                    return self.disable_hook_categories(*categories)
-                else:
-                    return self.enable_hook_categories(*categories)
-            self.set_hooks_mode(oldmode)
+            try:
+                if categories:
+                    if mode is self.HOOKS_DENY_ALL:
+                        return self.disable_hook_categories(*categories)
+                    else:
+                        return self.enable_hook_categories(*categories)
+            finally:
+                self.set_hooks_mode(oldmode)
 
     @property
     def disabled_hook_categories(self):