[Zope3-checkins] SVN: Zope3/branches/3.3/ - fixed issue 559: cgi variables as form field names

Christian Theune cvs-admin at zope.org
Sat Jun 17 01:25:23 EDT 2006


Log message for revision 68702:
   - fixed issue 559: cgi variables as form field names
  

Changed:
  U   Zope3/branches/3.3/doc/CHANGES.txt
  U   Zope3/branches/3.3/src/zope/publisher/browser.py
  U   Zope3/branches/3.3/src/zope/publisher/tests/test_browserrequest.py

-=-
Modified: Zope3/branches/3.3/doc/CHANGES.txt
===================================================================
--- Zope3/branches/3.3/doc/CHANGES.txt	2006-06-17 04:10:38 UTC (rev 68701)
+++ Zope3/branches/3.3/doc/CHANGES.txt	2006-06-17 05:25:20 UTC (rev 68702)
@@ -10,6 +10,9 @@
 
     Bugfixes
 
+      - Fixed issue 559: Removed filtering of CGI names when used as form
+        fields
+
       - Fixed issue 517: Bug in intid that doesn't respect that BTrees can not
         handle long.
 

Modified: Zope3/branches/3.3/src/zope/publisher/browser.py
===================================================================
--- Zope3/branches/3.3/src/zope/publisher/browser.py	2006-06-17 04:10:38 UTC (rev 68701)
+++ Zope3/branches/3.3/src/zope/publisher/browser.py	2006-06-17 05:25:20 UTC (rev 68702)
@@ -356,17 +356,15 @@
                 # skip over empty fields
                 return
 
-        # Filter out special names from form:
-        if not (isCGI_NAME(key) or key.startswith('HTTP_')):
-            # Make it unicode
-            key = self._decode(key)
-            if type(item) == StringType:
-                item = self._decode(item)
+        # Make it unicode
+        key = self._decode(key)
+        if type(item) == StringType:
+            item = self._decode(item)
 
-            if flags:
-                self.__setItemWithType(key, item, flags, converter)
-            else:
-                self.__setItemWithoutType(key, item)
+        if flags:
+            self.__setItemWithType(key, item, flags, converter)
+        else:
+            self.__setItemWithoutType(key, item)
 
     def __setItemWithoutType(self, key, item):
         """Set item value without explicit type."""

Modified: Zope3/branches/3.3/src/zope/publisher/tests/test_browserrequest.py
===================================================================
--- Zope3/branches/3.3/src/zope/publisher/tests/test_browserrequest.py	2006-06-17 04:10:38 UTC (rev 68701)
+++ Zope3/branches/3.3/src/zope/publisher/tests/test_browserrequest.py	2006-06-17 05:25:20 UTC (rev 68702)
@@ -424,6 +424,16 @@
         finally:
             sys.argv = argv
 
+    def testIssue559(self):
+        extra = {'QUERY_STRING': 'HTTP_REFERER=peter',
+                 'HTTP_REFERER':'http://localhost/',
+                 'PATH_INFO': '/folder/item3/'}
+        request = self._createRequest(extra)
+        publish(request)
+        self.assertEqual(request.headers.get('HTTP_REFERER'), 'http://localhost/')
+        self.assertEqual(request.form, {u'HTTP_REFERER': u'peter'})
+
+
 def test_suite():
     loader = unittest.TestLoader()
     return loader.loadTestsFromTestCase(BrowserTests)



More information about the Zope3-Checkins mailing list