cubicweb/pyramid/core.py
branch3.24
changeset 11824 d7ecf6dab085
parent 11811 f09efeead7f9
child 11913 4516c3956d46
child 11925 b75fc687c730
--- a/cubicweb/pyramid/core.py	Thu Nov 17 10:47:52 2016 +0100
+++ b/cubicweb/pyramid/core.py	Thu Nov 17 10:53:04 2016 +0100
@@ -32,6 +32,7 @@
     def __init__(self, session, *args, **kw):
         super(Connection, self).__init__(session, *args, **kw)
         self._session = session
+        self.lang = session._cached_lang
 
     def _get_session_data(self):
         return self._session.data
@@ -272,8 +273,9 @@
     """A lightweight version of
     :meth:`cubicweb.server.repository.Repository.connect` that does not keep
     track of opened sessions, removing the need of closing them"""
-    user = tools.cached_build_user(repo, eid)
+    user, lang = tools.cached_build_user(repo, eid)
     session = Session(request, user, repo)
+    session._cached_lang = lang
     tools.cnx_attach_entity(session, user)
     # Calling the hooks should be done only once, disabling it completely for
     # now