Commit fae47ebe authored by Nicola Spanti's avatar Nicola Spanti
Browse files

[server] Set language of connection in all cases

If `self.lang` was already defined (aka not `None`), the language
was not set. In consequence, when a pview was called, the language
was always considered to be english, this piece of information is
used by gettext, so it resulted in translation always done in
english language instead of using user preference as excepted.

closes #87
parent e4a09d53d980
Pipeline #25024 passed with stages
in 34 minutes and 18 seconds
# copyright 2003-2017 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact --
# copyright 2003-2020 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact --
# This file is part of CubicWeb.
......@@ -14,7 +14,8 @@
# details.
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <>.
# with CubicWeb. If not, see <>.
"""Repository users' and internal' sessions."""
import functools
......@@ -339,7 +340,8 @@ class Connection(RequestSessionBase):
self._open = True
self.cnxset = self.repo.cnxsets.get()
if self.lang is None:
self.lang = self.user.prefered_language()
return self
def __exit__(self, exctype=None, excvalue=None, tb=None):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment