server/sources/native.py
changeset 9487 88a092a665f4
parent 9482 5b97e69f9c29
child 9512 88dc96fc9fc1
equal deleted inserted replaced
9486:9a62c52d167e 9487:88a092a665f4
   904         self.doexec(session, self.sqlgen.delete_many('entities', attrs), attrs)
   904         self.doexec(session, self.sqlgen.delete_many('entities', attrs), attrs)
   905 
   905 
   906     # undo support #############################################################
   906     # undo support #############################################################
   907 
   907 
   908     def undoable_transactions(self, session, ueid=None, **actionfilters):
   908     def undoable_transactions(self, session, ueid=None, **actionfilters):
   909         """See :class:`cubicweb.dbapi.Connection.undoable_transactions`"""
   909         """See :class:`cubicweb.repoapi.ClientConnection.undoable_transactions`"""
   910         # force filtering to session's user if not a manager
   910         # force filtering to session's user if not a manager
   911         if not session.user.is_in_group('managers'):
   911         if not session.user.is_in_group('managers'):
   912             ueid = session.user.eid
   912             ueid = session.user.eid
   913         restr = {}
   913         restr = {}
   914         if ueid is not None:
   914         if ueid is not None:
   976         cu = self.doexec(session, sql, restr)
   976         cu = self.doexec(session, sql, restr)
   977         # turn results into transaction objects
   977         # turn results into transaction objects
   978         return [tx.Transaction(*args) for args in cu.fetchall()]
   978         return [tx.Transaction(*args) for args in cu.fetchall()]
   979 
   979 
   980     def tx_info(self, session, txuuid):
   980     def tx_info(self, session, txuuid):
   981         """See :class:`cubicweb.dbapi.Connection.transaction_info`"""
   981         """See :class:`cubicweb.repoapi.ClientConnection.transaction_info`"""
   982         return tx.Transaction(txuuid, *self._tx_info(session, txuuid))
   982         return tx.Transaction(txuuid, *self._tx_info(session, txuuid))
   983 
   983 
   984     def tx_actions(self, session, txuuid, public):
   984     def tx_actions(self, session, txuuid, public):
   985         """See :class:`cubicweb.dbapi.Connection.transaction_actions`"""
   985         """See :class:`cubicweb.repoapi.ClientConnection.transaction_actions`"""
   986         self._tx_info(session, txuuid)
   986         self._tx_info(session, txuuid)
   987         restr = {'tx_uuid': txuuid}
   987         restr = {'tx_uuid': txuuid}
   988         if public:
   988         if public:
   989             restr['txa_public'] = True
   989             restr['txa_public'] = True
   990         # XXX use generator to avoid loading everything in memory?
   990         # XXX use generator to avoid loading everything in memory?
  1000         cu = self.doexec(session, sql, restr)
  1000         cu = self.doexec(session, sql, restr)
  1001         actions += [tx.RelationAction(*args) for args in cu.fetchall()]
  1001         actions += [tx.RelationAction(*args) for args in cu.fetchall()]
  1002         return sorted(actions, key=lambda x: x.order)
  1002         return sorted(actions, key=lambda x: x.order)
  1003 
  1003 
  1004     def undo_transaction(self, session, txuuid):
  1004     def undo_transaction(self, session, txuuid):
  1005         """See :class:`cubicweb.dbapi.Connection.undo_transaction`
  1005         """See :class:`cubicweb.repoapi.ClientConnection.undo_transaction`
  1006 
  1006 
  1007         important note: while undoing of a transaction, only hooks in the
  1007         important note: while undoing of a transaction, only hooks in the
  1008         'integrity', 'activeintegrity' and 'undo' categories are called.
  1008         'integrity', 'activeintegrity' and 'undo' categories are called.
  1009         """
  1009         """
  1010         # set mode so connections set isn't released subsquently until commit/rollback
  1010         # set mode so connections set isn't released subsquently until commit/rollback