[PATCH 1 of 2 saem] [patches] Move negotiated_language monkey patch to the non temporary patches section

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Apr 21 16:11:53 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1492779304 -7200
#      Fri Apr 21 14:55:04 2017 +0200
# Node ID cabb03fa400a48fee1228860e65c1b9da2ab6d30
# Parent  390a4f075ad402d3fc81dbb7e45f1634efa58e30
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r cabb03fa400a
[patches] Move negotiated_language monkey patch to the non temporary patches section

Until there is a proper api to do this in cubicweb, which is not planned yet,
we've to keep this.

diff --git a/cubicweb_saem_ref/site_cubicweb.py b/cubicweb_saem_ref/site_cubicweb.py
--- a/cubicweb_saem_ref/site_cubicweb.py
+++ b/cubicweb_saem_ref/site_cubicweb.py
@@ -161,10 +161,18 @@ seda.GRAPH_SKIP_ETYPES.add('Activity')
 seda.GRAPH_SKIP_RTYPES.add('new_version_of')
 Entity.cw_skip_copy_for.append(('new_version_of', 'subject'))
 Entity.cw_skip_copy_for.append(('new_version_of', 'object'))
 
 
+ at monkeypatch(request._CubicWebRequestBase)
+def negotiated_language(self):
+    # Force language to fr since in http-negociation mode there is no way to
+    # force french language with a browser configured in english.
+    # This is currently the easiest way to force the language of an instance.
+    return 'fr'
+
+
 ####################################################################################################
 # temporary monkey-patches #########################################################################
 ####################################################################################################
 
 # proper behaviour of hooks control cm (https://www.cubicweb.org/ticket/17049333)
@@ -208,11 +216,5 @@ def is_hook_category_activated(self, cat
     if self._hooks_mode is session.HOOKS_DENY_ALL:
         return category in self._hooks_categories
     return category not in self._hooks_categories
 
 
- at monkeypatch(request._CubicWebRequestBase)
-def negotiated_language(self):
-    # Force language to fr since in http-negociation mode there is no way to
-    # force french language with a browser configured in english.
-    # This is currently the easiest way to force the language of an instance.
-    return 'fr'


More information about the saem-devel mailing list