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

Sylvain Thenault sylvain.thenault at logilab.fr
Wed May 10 15:24:38 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 82b88d0922de4b7c8f2c55899b1d10c850ff281a
# Parent  acba069ac98ec6ba55c99c9a43c29d4a7bcdfd83
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r 82b88d0922de
[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
@@ -162,10 +162,18 @@ for rtype in ('new_version_of', 'use_pro
     seda.GRAPH_SKIP_RTYPES.add(rtype)
     Entity.cw_skip_copy_for.append((rtype, 'subject'))
     Entity.cw_skip_copy_for.append((rtype, '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)
@@ -209,11 +217,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