From 8a64d00ab41670a72db91c39b83917898cb7da2a Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Wed, 11 Jun 2008 00:15:47 +0000
Subject: [PATCH] 2008-06-11 yo * Append LOCALIZER_LANGUAGE=xxx to the
 redirected URL in Base_doLanguage. This is a hack to prevent false caching.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21483 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_xhtml_style/Base_doLanguage.xml      | 34 ++++++++++++++-----
 .../bootstrap/erp5_xhtml_style/bt/change_log  |  5 ++-
 .../bootstrap/erp5_xhtml_style/bt/revision    |  2 +-
 3 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doLanguage.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doLanguage.xml
index 3257936b22..ac9ddc9242 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doLanguage.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doLanguage.xml
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.PythonScripts.PythonScript</string>
-          <string>PythonScript</string>
-        </tuple>
-        <none/>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -68,10 +65,28 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string># XXX Localizer-dependent\n
+            <value> <string encoding="cdata"><![CDATA[
+
+# XXX Localizer-dependent\n
 portal = context.getPortalObject()\n
-portal.Localizer.changeLanguage(select_language)\n
-</string> </value>
+\n
+# Make the URL for the redirection. The language is appended, because when HTTP caching is utilized,\n
+# If-Modified-Since ignores Vary, so the URL must be different from another language. Note that this\n
+# is still a kind of hack, because the language is not appended to other links.\n
+\n
+# XXX relying on the referer is a bad idea, but we don\'t have any other way to retrieve the original URL\n
+# currently.\n
+url = context.REQUEST[\'HTTP_REFERER\']\n
+if \'?\' in url:\n
+  delimiter = \'&\'\n
+else:\n
+  delimiter = \'?\'\n
+url = \'%s%sLOCALIZER_LANGUAGE=%s\' % (url, delimiter, select_language)\n
+\n
+portal.Localizer.changeLanguage(select_language, goto=url)\n
+
+
+]]></string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
@@ -123,6 +138,9 @@ portal.Localizer.changeLanguage(select_language)\n
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>portal</string>
+                            <string>_getitem_</string>
+                            <string>url</string>
+                            <string>delimiter</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log b/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log
index 474bf13ea2..9d21a19d53 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log
@@ -1,3 +1,6 @@
+2008-06-11 yo
+* Append LOCALIZER_LANGUAGE=xxx to the redirected URL in Base_doLanguage. This is a hack to prevent false caching.
+
 2008-06-09 kazuhiko
 * Add icons for domain tree.
 
@@ -205,4 +208,4 @@
 
 2006-06-15 Vincent
 * Initial commit.
-* Valid XHTML1.0 Strict + CSS 2.0.
+* Valid XHTML1.0 Strict + CSS 2.0.
\ No newline at end of file
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
index 55a318f19d..4a722e9c7f 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
@@ -1 +1 @@
-551
\ No newline at end of file
+552
\ No newline at end of file
-- 
2.30.9