[Checkins] SVN: z3c.pt/trunk/ Do not rely on LANGUAGE key on request to skip negotiation; the value is implementation-specific, and not always a valid 'target_language' string.

Malthe Borch cvs-admin at zope.org
Tue Apr 24 10:48:45 UTC 2012


Log message for revision 125271:
  Do not rely on LANGUAGE key on request to skip negotiation; the value is implementation-specific, and not always a valid 'target_language' string.

Changed:
  U   z3c.pt/trunk/CHANGES.txt
  U   z3c.pt/trunk/src/z3c/pt/pagetemplate.py

-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt	2012-04-24 10:37:21 UTC (rev 125270)
+++ z3c.pt/trunk/CHANGES.txt	2012-04-24 10:48:42 UTC (rev 125271)
@@ -1,6 +1,14 @@
 Changelog
 =========
 
+In next release ...
+
+Bugfixes:
+
+- Do not rely on the "LANGUAGE" request key to skip language
+  negotiation. Instead, we assume that negotiation is cheap (and
+  probably cached).
+
 2.2.1 (2012-02-15)
 ~~~~~~~~~~~~~~~~~~
 

Modified: z3c.pt/trunk/src/z3c/pt/pagetemplate.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/pagetemplate.py	2012-04-24 10:37:21 UTC (rev 125270)
+++ z3c.pt/trunk/src/z3c/pt/pagetemplate.py	2012-04-24 10:48:42 UTC (rev 125271)
@@ -117,13 +117,10 @@
         request = context.setdefault('request', None)
 
         if target_language is None:
-            if hasattr(request, "get"):
-                target_language = request.get("LANGUAGE", None)
-            if target_language is None:
-                try:
-                    target_language = i18n.negotiate(request)
-                except:
-                    target_language = None
+            try:
+                target_language = i18n.negotiate(request)
+            except:
+                target_language = None
 
         context['target_language'] = target_language
 



More information about the checkins mailing list