[session/transaction] pass the session object to the Transaction __init__
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 27 Mar 2013 11:01:40 +0100
changeset 8810 1a25bdd49f9a
parent 8809 9ee4d0c65ad2
child 8811 1b7b4709c0cf
[session/transaction] pass the session object to the Transaction __init__ This simplify access to variables. As we are moving more and more logic and states in the Transaction it will greatly helps in future commit.
server/session.py
--- a/server/session.py	Wed Mar 27 19:54:36 2013 +0100
+++ b/server/session.py	Wed Mar 27 11:01:40 2013 +0100
@@ -335,18 +335,18 @@
 
     """
 
-    def __init__(self, txid, cnxset_tracker, mode, rewriter):
+    def __init__(self, txid, session, rewriter):
         #: transaction unique id
         self.transactionid = txid
         #: reentrance handling
         self.ctx_count = 0
 
         #: connection handling mode
-        self.mode = mode
+        self.mode = session.default_mode
         #: connection set used to execute queries on sources
         self._cnxset = None
         #: CnxSetTracker used to report cnxset usage
-        self._cnxset_tracker = cnxset_tracker
+        self._cnxset_tracker = session._cnxset_tracker
         #: is this transaction from a client or internal to the repo
         self.running_dbapi_query = True
 
@@ -726,8 +726,7 @@
                 tx = self._txs[txid]
             except KeyError:
                 rewriter = RQLRewriter(self)
-                tx = Transaction(txid, self._cnxset_tracker, self.default_mode,
-                                 rewriter)
+                tx = Transaction(txid, self, rewriter)
                 self._txs[txid] = tx
         return tx