[session/transaction] move add operation in session code
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 25 Mar 2013 16:12:39 +0100
changeset 8786 c2bc0b804982
parent 8785 8f2786492369
child 8787 1b3b7284377f
[session/transaction] move add operation in session code
server/session.py
--- a/server/session.py	Mon Mar 25 16:13:34 2013 +0100
+++ b/server/session.py	Mon Mar 25 16:12:39 2013 +0100
@@ -290,6 +290,14 @@
         """
         return eid in self.data.get('neweids', ())
 
+    # Operation management ####################################################
+
+    def add_operation(self, operation, index=None):
+        """add an operation to be executed at the end of the transaction"""
+        if index is None:
+            self.pending_operations.append(operation)
+        else:
+            self.pending_operations.insert(index, operation)
 
 
 
@@ -1216,13 +1224,7 @@
     transaction_data = tx_attr('data')
     pending_operations = tx_attr('pending_operations')
     pruned_hooks_cache = tx_attr('pruned_hooks_cache')
-
-    def add_operation(self, operation, index=None):
-        """add an operation"""
-        if index is None:
-            self.pending_operations.append(operation)
-        else:
-            self.pending_operations.insert(index, operation)
+    add_operation      = tx_meth('add_operation')
 
     # undo support ############################################################