[transaction] rename transaction_data to data
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 22 Mar 2013 20:11:17 +0100
changeset 8779 9b2f68916474
parent 8778 9d6a34b9838d
child 8780 d3e49fc74e79
[transaction] rename transaction_data to data Transaction.transaction_data is redundant. A transaction_data property is left for backward compatibility. Deprecation mechanism will come in later changeset
server/session.py
--- a/server/session.py	Fri Mar 22 19:58:43 2013 +0100
+++ b/server/session.py	Fri Mar 22 20:11:17 2013 +0100
@@ -165,7 +165,7 @@
 
     Internal transaction data:
 
-      :attr:`transaction_data`,is a dictionary containing some shared data
+      :attr:`data`,is a dictionary containing some shared data
       cleared at the end of the transaction. Hooks and operations may put
       arbitrary data in there, and this may also be used as a communication
       channel between the client and the repository.
@@ -208,7 +208,7 @@
         self.cnxset = None
 
         #: dict containing arbitrary data cleared at the end of the transaction
-        self.transaction_data = {}
+        self.data = {}
         #: ordered list of operations to be processed on commit/rollback
         self.pending_operations = []
         #: (None, 'precommit', 'postcommit', 'uncommitable')
@@ -228,10 +228,14 @@
         # RQLRewriter are not thread safe
         self._rewriter = rewriter
 
+    @property
+    def transaction_data(self):
+        return self.data
+
 
     def clear(self):
         """reset internal data"""
-        self.transaction_data = {}
+        self.data = {}
         #: ordered list of operations to be processed on commit/rollback
         self.pending_operations = []
         #: (None, 'precommit', 'postcommit', 'uncommitable')
@@ -451,8 +455,8 @@
         tx.pending_operations = self.pending_operations
         # everything in transaction_data should be copied back but the entity
         # type cache we don't want to avoid security pb
-        tx.transaction_data = self.transaction_data.copy()
-        tx.transaction_data.pop('ecache', None)
+        tx.data = self.transaction_data.copy()
+        tx.data.pop('ecache', None)
         return session
 
     def add_relation(self, fromeid, rtype, toeid):