950 self.doexec(cnx, self.sqlgen.delete_many('entities', attrs), attrs) |
950 self.doexec(cnx, self.sqlgen.delete_many('entities', attrs), attrs) |
951 |
951 |
952 # undo support ############################################################# |
952 # undo support ############################################################# |
953 |
953 |
954 def undoable_transactions(self, cnx, ueid=None, **actionfilters): |
954 def undoable_transactions(self, cnx, ueid=None, **actionfilters): |
955 """See :class:`cubicweb.repoapi.ClientConnection.undoable_transactions`""" |
955 """See :class:`cubicweb.repoapi.Connection.undoable_transactions`""" |
956 # force filtering to connection's user if not a manager |
956 # force filtering to connection's user if not a manager |
957 if not cnx.user.is_in_group('managers'): |
957 if not cnx.user.is_in_group('managers'): |
958 ueid = cnx.user.eid |
958 ueid = cnx.user.eid |
959 restr = {} |
959 restr = {} |
960 if ueid is not None: |
960 if ueid is not None: |
1023 cu = self.doexec(cnx, sql, restr) |
1023 cu = self.doexec(cnx, sql, restr) |
1024 # turn results into transaction objects |
1024 # turn results into transaction objects |
1025 return [tx.Transaction(*args) for args in cu.fetchall()] |
1025 return [tx.Transaction(*args) for args in cu.fetchall()] |
1026 |
1026 |
1027 def tx_info(self, cnx, txuuid): |
1027 def tx_info(self, cnx, txuuid): |
1028 """See :class:`cubicweb.repoapi.ClientConnection.transaction_info`""" |
1028 """See :class:`cubicweb.repoapi.Connection.transaction_info`""" |
1029 return tx.Transaction(txuuid, *self._tx_info(cnx, unicode(txuuid))) |
1029 return tx.Transaction(txuuid, *self._tx_info(cnx, unicode(txuuid))) |
1030 |
1030 |
1031 def tx_actions(self, cnx, txuuid, public): |
1031 def tx_actions(self, cnx, txuuid, public): |
1032 """See :class:`cubicweb.repoapi.ClientConnection.transaction_actions`""" |
1032 """See :class:`cubicweb.repoapi.Connection.transaction_actions`""" |
1033 txuuid = unicode(txuuid) |
1033 txuuid = unicode(txuuid) |
1034 self._tx_info(cnx, txuuid) |
1034 self._tx_info(cnx, txuuid) |
1035 restr = {'tx_uuid': txuuid} |
1035 restr = {'tx_uuid': txuuid} |
1036 if public: |
1036 if public: |
1037 restr['txa_public'] = True |
1037 restr['txa_public'] = True |
1050 cu = self.doexec(cnx, sql, restr) |
1050 cu = self.doexec(cnx, sql, restr) |
1051 actions += [tx.RelationAction(*args) for args in cu.fetchall()] |
1051 actions += [tx.RelationAction(*args) for args in cu.fetchall()] |
1052 return sorted(actions, key=lambda x: x.order) |
1052 return sorted(actions, key=lambda x: x.order) |
1053 |
1053 |
1054 def undo_transaction(self, cnx, txuuid): |
1054 def undo_transaction(self, cnx, txuuid): |
1055 """See :class:`cubicweb.repoapi.ClientConnection.undo_transaction` |
1055 """See :class:`cubicweb.repoapi.Connection.undo_transaction` |
1056 |
1056 |
1057 important note: while undoing of a transaction, only hooks in the |
1057 important note: while undoing of a transaction, only hooks in the |
1058 'integrity', 'activeintegrity' and 'undo' categories are called. |
1058 'integrity', 'activeintegrity' and 'undo' categories are called. |
1059 """ |
1059 """ |
1060 # set mode so connections set isn't released subsquently until commit/rollback |
1060 # set mode so connections set isn't released subsquently until commit/rollback |