[connection] invert __init__ parameter
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 25 Jun 2013 18:15:45 +0200
changeset 9095 6656fafd96c8
parent 9094 b151beea9cb6
child 9096 9d1b5f07d9ca
[connection] invert __init__ parameter Takes session first. At some point, the connection_id will become optional for Connection created explicitly.
server/session.py
--- a/server/session.py	Wed Jun 26 13:43:22 2013 +0200
+++ b/server/session.py	Tue Jun 25 18:15:45 2013 +0200
@@ -419,7 +419,7 @@
 
     is_request = False
 
-    def __init__(self, cnxid, session):
+    def __init__(self, session, cnxid):
         # using super(Connection, self) confuse some test hack
         RequestSessionBase.__init__(self, session.vreg)
         #: connection unique id
@@ -1259,7 +1259,7 @@
                     raise SessionClosedError('try to access connections set on a closed session %s' % self.id)
                 cnx = self._cnxs[cnxid]
             except KeyError:
-                cnx = Connection(cnxid, self)
+                cnx = Connection(self, cnxid=cnxid)
                 self._cnxs[cnxid] = cnx
         return cnx