[Zope3-checkins] SVN: Zope3/trunk/src/zope/publisher/ fixed
handling of special post requests where a field name could be None
Bernd Dorn
bernd.dorn at fhv.at
Tue Jul 11 03:41:14 EDT 2006
Log message for revision 69090:
fixed handling of special post requests where a field name could be None
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-07-11 05:05:27 UTC (rev 69089)
+++ Zope3/trunk/src/zope/publisher/browser.py 2006-07-11 07:41:13 UTC (rev 69090)
@@ -356,8 +356,10 @@
# skip over empty fields
return
- # Make it unicode
- key = self._decode(key)
+ # Make it unicode if not None
+ if key is not None:
+ key = self._decode(key)
+
if type(item) == StringType:
item = self._decode(item)
Modified: Zope3/trunk/src/zope/publisher/tests/test_browserrequest.py
===================================================================
--- Zope3/trunk/src/zope/publisher/tests/test_browserrequest.py 2006-07-11 05:05:27 UTC (rev 69089)
+++ Zope3/trunk/src/zope/publisher/tests/test_browserrequest.py 2006-07-11 07:41:13 UTC (rev 69090)
@@ -157,6 +157,26 @@
self.assertEqual(response.getBase(),
'http://foobar.com/folder/item2/view/index')
+ def testNoneFieldNamePost(self):
+
+ """Produce a Fieldstorage with a name wich is None, this
+ should be catched"""
+
+ extra = {'REQUEST_METHOD':'POST',
+ 'PATH_INFO': u'/',
+ 'CONTENT_TYPE': 'multipart/form-data;\
+ boundary=---------------------------1'}
+
+ body = """-----------------------------1
+ Content-Disposition: form-data; name="field.contentType"
+ ...
+ application/octet-stream
+ -----------------------------1--
+ """
+ request = self._createRequest(extra,body=body)
+ request.processInputs()
+
+
def testDefault2(self):
extra = {'PATH_INFO': '/folder/item2/view'}
request = self._createRequest(extra)
More information about the Zope3-Checkins
mailing list