[connection] move last part of undo logic in connection
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 23 May 2013 14:17:46 +0200
changeset 9075 8d36838ccb3e
parent 9074 0616f7a713c6
child 9076 7743e7b29635
[connection] move last part of undo logic in connection Now that Connection have a reference to the repo it can handle all of it itself
server/session.py
--- a/server/session.py	Tue Jun 25 17:28:41 2013 +0200
+++ b/server/session.py	Thu May 23 14:17:46 2013 +0200
@@ -686,7 +686,8 @@
     def transaction_uuid(self, set=True):
         uuid = self.transaction_data.get('tx_uuid')
         if set and uuid is None:
-            raise KeyError
+            self.transaction_data['tx_uuid'] = uuid = uuid4().hex
+            self.repo.system_source.start_undoable_transaction(self, uuid)
         return uuid
 
     def transaction_inc_action_counter(self):
@@ -1432,14 +1433,7 @@
 
     ertype_supports_undo = cnx_meth('ertype_supports_undo')
     transaction_inc_action_counter = cnx_meth('transaction_inc_action_counter')
-
-    def transaction_uuid(self, set=True):
-        try:
-            return self._cnx.transaction_uuid(set=set)
-        except KeyError:
-            self._cnx.transaction_data['tx_uuid'] = uuid = uuid4().hex
-            self.repo.system_source.start_undoable_transaction(self, uuid)
-            return uuid
+    transaction_uuid = cnx_meth('transaction_uuid')
 
     # querier helpers #########################################################