[Checkins] SVN: zope.publisher/branches/3.3/ Backported r84616 to the 3.3 branch

Hanno Schlichting plone at hannosch.info
Mon Feb 9 07:38:59 EST 2009


Log message for revision 96307:
  Backported r84616 to the 3.3 branch
  

Changed:
  U   zope.publisher/branches/3.3/CHANGES.txt
  U   zope.publisher/branches/3.3/src/zope/publisher/http.py
  U   zope.publisher/branches/3.3/src/zope/publisher/tests/test_httpcharsets.py

-=-
Modified: zope.publisher/branches/3.3/CHANGES.txt
===================================================================
--- zope.publisher/branches/3.3/CHANGES.txt	2009-02-09 12:34:18 UTC (rev 96306)
+++ zope.publisher/branches/3.3/CHANGES.txt	2009-02-09 12:38:59 UTC (rev 96307)
@@ -4,9 +4,13 @@
 3.3.x (unreleased)
 ------------------
 
-* ...
+- https://bugs.launchpad.net/zope2/+bug/143873
 
+  The zope.publisher.http.HTTPCharsets was confused by the Zope 2
+  publisher, which gives missleading information about which headers
+  it has.
+
 3.3.2 (2007-07-03)
 ------------------
 
-Release as a separate project, corresponds to zope.publisher from Zope 3.3.2
+- Release as a separate project, corresponds to zope.publisher from Zope 3.3.2

Modified: zope.publisher/branches/3.3/src/zope/publisher/http.py
===================================================================
--- zope.publisher/branches/3.3/src/zope/publisher/http.py	2009-02-09 12:34:18 UTC (rev 96306)
+++ zope.publisher/branches/3.3/src/zope/publisher/http.py	2009-02-09 12:38:59 UTC (rev 96307)
@@ -993,7 +993,7 @@
         '''See interface IUserPreferredCharsets'''
         charsets = []
         sawstar = sawiso88591 = 0
-        header_present = 'HTTP_ACCEPT_CHARSET' in self.request
+        header_present = bool(self.request.get('HTTP_ACCEPT_CHARSET'))
         for charset in self.request.get('HTTP_ACCEPT_CHARSET', '').split(','):
             charset = charset.strip().lower()
             if charset:

Modified: zope.publisher/branches/3.3/src/zope/publisher/tests/test_httpcharsets.py
===================================================================
--- zope.publisher/branches/3.3/src/zope/publisher/tests/test_httpcharsets.py	2009-02-09 12:34:18 UTC (rev 96306)
+++ zope.publisher/branches/3.3/src/zope/publisher/tests/test_httpcharsets.py	2009-02-09 12:38:59 UTC (rev 96307)
@@ -78,7 +78,17 @@
         self.assertEqual(list(browser_charsets.getPreferredCharsets()),
                          [])
 
+    def testTrivialHTTP_ACCEPT_CHARSET(self):
+        # If the client provides a trivial HTTP_ACCEPT_CHARSET, it should
+        # accept any charset (this test is aimed at Zope 2's handling
+        # of request queries for entries starting with HTTP_
+        # See: https://bugs.launchpad.net/zope2/+bug/143873
+        request = {'HTTP_ACCEPT_CHARSET': ''}
+        browser_charsets = HTTPCharsets(request)
+        self.assertEqual(list(browser_charsets.getPreferredCharsets()),
+                         [])
 
+
 def test_suite():
     loader=unittest.TestLoader()
     return loader.loadTestsFromTestCase(HTTPCharsetTest)



More information about the Checkins mailing list