[undo] during undoing, call hooks in the [active]integrity and undo categories stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 30 Mar 2010 11:06:13 +0200
branchstable
changeset 5071 8631bb9f6e73
parent 5070 b1f80ccadda3
child 5072 072ae171aeb0
[undo] during undoing, call hooks in the [active]integrity and undo categories
server/sources/native.py
--- a/server/sources/native.py	Tue Mar 30 11:01:34 2010 +0200
+++ b/server/sources/native.py	Tue Mar 30 11:06:13 2010 +0200
@@ -806,11 +806,17 @@
         return sorted(actions, key=lambda x: x.order)
 
     def undo_transaction(self, session, txuuid):
-        """See :class:`cubicweb.dbapi.Connection.undo_transaction`"""
+        """See :class:`cubicweb.dbapi.Connection.undo_transaction`
+
+        important note: while undoing of a transaction, only hooks in the
+        'integrity', 'activeintegrity' and 'undo' categories are called.
+        """
         # set mode so pool isn't released subsquently until commit/rollback
         session.mode = 'write'
         errors = []
-        with hooks_control(session, session.HOOKS_DENY_ALL, 'integrity'):
+        session.transaction_data['undoing_uuid'] = txuuid
+        with hooks_control(session, session.HOOKS_DENY_ALL,
+                           'integrity', 'activeintegrity', 'undo'):
             with security_enabled(session, read=False):
                 for action in reversed(self.tx_actions(session, txuuid, False)):
                     undomethod = getattr(self, '_undo_%s' % action.action.lower())