server/sources/native.py
branchstable
changeset 5071 8631bb9f6e73
parent 5070 b1f80ccadda3
child 5072 072ae171aeb0
equal deleted inserted replaced
5070:b1f80ccadda3 5071:8631bb9f6e73
   804         cu = self.doexec(session, sql, restr)
   804         cu = self.doexec(session, sql, restr)
   805         actions += [tx.RelationAction(*args) for args in cu.fetchall()]
   805         actions += [tx.RelationAction(*args) for args in cu.fetchall()]
   806         return sorted(actions, key=lambda x: x.order)
   806         return sorted(actions, key=lambda x: x.order)
   807 
   807 
   808     def undo_transaction(self, session, txuuid):
   808     def undo_transaction(self, session, txuuid):
   809         """See :class:`cubicweb.dbapi.Connection.undo_transaction`"""
   809         """See :class:`cubicweb.dbapi.Connection.undo_transaction`
       
   810 
       
   811         important note: while undoing of a transaction, only hooks in the
       
   812         'integrity', 'activeintegrity' and 'undo' categories are called.
       
   813         """
   810         # set mode so pool isn't released subsquently until commit/rollback
   814         # set mode so pool isn't released subsquently until commit/rollback
   811         session.mode = 'write'
   815         session.mode = 'write'
   812         errors = []
   816         errors = []
   813         with hooks_control(session, session.HOOKS_DENY_ALL, 'integrity'):
   817         session.transaction_data['undoing_uuid'] = txuuid
       
   818         with hooks_control(session, session.HOOKS_DENY_ALL,
       
   819                            'integrity', 'activeintegrity', 'undo'):
   814             with security_enabled(session, read=False):
   820             with security_enabled(session, read=False):
   815                 for action in reversed(self.tx_actions(session, txuuid, False)):
   821                 for action in reversed(self.tx_actions(session, txuuid, False)):
   816                     undomethod = getattr(self, '_undo_%s' % action.action.lower())
   822                     undomethod = getattr(self, '_undo_%s' % action.action.lower())
   817                     errors += undomethod(session, action)
   823                     errors += undomethod(session, action)
   818         # remove the transactions record
   824         # remove the transactions record