[session] all cnx._session become cnx.session
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 13 Jun 2014 15:42:04 +0200
changeset 10355 60b8204fcca3
parent 10354 635cfac73d28
child 10356 a009a31fb1ea
[session] all cnx._session become cnx.session The _session belonged to ClientConnection, which is just gone. Related to #3837233.
devtools/testlib.py
server/migractions.py
server/session.py
web/application.py
web/request.py
--- a/devtools/testlib.py	Tue Jun 10 16:01:49 2014 +0200
+++ b/devtools/testlib.py	Fri Jun 13 15:42:04 2014 +0200
@@ -331,7 +331,7 @@
             self._pop_custom_cnx()
         else:
             self._cnxs.add(cnx) # register the cnx to make sure it is removed
-            self._current_session = cnx._session
+            self._current_session = cnx.session
             self._current_clt_cnx = cnx
 
     @property
--- a/server/migractions.py	Tue Jun 10 16:01:49 2014 +0200
+++ b/server/migractions.py	Fri Jun 13 15:42:04 2014 +0200
@@ -94,7 +94,7 @@
             assert repo
             self.cnx = cnx
             self.repo = repo
-            self.session = cnx._session
+            self.session = cnx.session
         elif connect:
             self.repo_connect()
             self.set_cnx()
--- a/server/session.py	Tue Jun 10 16:01:49 2014 +0200
+++ b/server/session.py	Fri Jun 13 15:42:04 2014 +0200
@@ -527,26 +527,20 @@
         else:
             self._set_user(session.user)
 
-    # session bw compat
-
-    @property
-    def _session(self):
-        return self.session
-
     @_open_only
     def source_defs(self):
         """Return the definition of sources used by the repository."""
-        return self._session.repo.source_defs()
+        return self.session.repo.source_defs()
 
     @_open_only
     def get_schema(self):
         """Return the schema currently used by the repository."""
-        return self._session.repo.source_defs()
+        return self.session.repo.source_defs()
 
     @_open_only
     def get_option_value(self, option):
         """Return the value for `option` in the configuration."""
-        return self._session.repo.get_option_value(option)
+        return self.session.repo.get_option_value(option)
 
     # transaction api
 
--- a/web/application.py	Tue Jun 10 16:01:49 2014 +0200
+++ b/web/application.py	Fri Jun 13 15:42:04 2014 +0200
@@ -52,10 +52,10 @@
 @contextmanager
 def anonymized_request(req):
     orig_cnx = req.cnx
-    anon_clt_cnx = anonymous_cnx(orig_cnx._session.repo)
-    req.set_cnx(anon_clt_cnx)
+    anon_cnx = anonymous_cnx(orig_cnx.session.repo)
+    req.set_cnx(anon_cnx)
     try:
-        with anon_clt_cnx:
+        with anon_cnx:
             yield req
     finally:
         req.set_cnx(orig_cnx)
--- a/web/request.py	Tue Jun 10 16:01:49 2014 +0200
+++ b/web/request.py	Fri Jun 13 15:42:04 2014 +0200
@@ -981,11 +981,11 @@
         return True
 
 class ConnectionCubicWebRequestBase(_CubicWebRequestBase):
+    cnx = None
+    session = None
 
     def __init__(self, vreg, https=False, form=None, headers={}):
         """"""
-        self.cnx = None
-        self.session = None
         self.vreg = vreg
         try:
             # no vreg or config which doesn't handle translations
@@ -1005,7 +1005,7 @@
         if 'ecache' in cnx.transaction_data:
             del cnx.transaction_data['ecache']
         self.cnx = cnx
-        self.session = cnx._session
+        self.session = cnx.session
         self._set_user(cnx.user)
         self.set_user_language(cnx.user)