[Zope3-checkins] SVN: Zope3/trunk/src/zope/publisher/ - fix for
issue 559: allow cgi env names as form field names
Christian Theune
cvs-admin at zope.org
Sat Jun 17 01:38:58 EDT 2006
Log message for revision 68703:
- fix for issue 559: allow cgi env names as form field names
Changed:
U Zope3/trunk/src/zope/publisher/browser.py
U Zope3/trunk/src/zope/publisher/tests/test_browserrequest.py
-=-
Modified: Zope3/trunk/src/zope/publisher/browser.py
===================================================================
--- Zope3/trunk/src/zope/publisher/browser.py 2006-06-17 05:25:20 UTC (rev 68702)
+++ Zope3/trunk/src/zope/publisher/browser.py 2006-06-17 05:38:55 UTC (rev 68703)
@@ -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/trunk/src/zope/publisher/tests/test_browserrequest.py
===================================================================
--- Zope3/trunk/src/zope/publisher/tests/test_browserrequest.py 2006-06-17 05:25:20 UTC (rev 68702)
+++ Zope3/trunk/src/zope/publisher/tests/test_browserrequest.py 2006-06-17 05:38:55 UTC (rev 68703)
@@ -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