[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/ Applied patch from https://bugs.launchpad.net/zope2/+bug/257675, avoiding the mysterious '-C' in request.form

Hanno Schlichting hannosch at hannosch.eu
Thu Apr 1 17:05:14 EDT 2010


Log message for revision 110440:
  Applied patch from https://bugs.launchpad.net/zope2/+bug/257675, avoiding the mysterious '-C' in request.form
  

Changed:
  U   Zope/trunk/src/ZPublisher/HTTPRequest.py
  U   Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py

-=-
Modified: Zope/trunk/src/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/trunk/src/ZPublisher/HTTPRequest.py	2010-04-01 21:04:58 UTC (rev 110439)
+++ Zope/trunk/src/ZPublisher/HTTPRequest.py	2010-04-01 21:05:14 UTC (rev 110440)
@@ -478,6 +478,12 @@
         other = self.other
         taintedform = self.taintedform
 
+        # If 'QUERY_STRING' is not present in environ
+        # FieldStorage will try to get it from sys.argv[1]
+        # which is not what we need.
+        if not environ.has_key('QUERY_STRING'):
+            environ['QUERY_STRING'] = ''
+
         meth = None
         fs = ZopeFieldStorage(fp=fp,environ=environ,keep_blank_values=1)
         if not hasattr(fs,'list') or fs.list is None:

Modified: Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py
===================================================================
--- Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py	2010-04-01 21:04:58 UTC (rev 110439)
+++ Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py	2010-04-01 21:05:14 UTC (rev 110440)
@@ -128,6 +128,13 @@
                 "Key %s not correctly reproduced in tainted; expected %r, "
                 "got %r" % (key, req.form[key], req.taintedform[key]))
 
+    def test_processInputs_wo_query_string(self):
+        env = {'SERVER_NAME': 'testingharnas', 'SERVER_PORT': '80'}
+        req = self._makeOne(environ=env)
+        req.processInputs()
+        self._noFormValuesInOther(req)
+        self.assertEquals(req.form, {})
+
     def test_processInputs_wo_marshalling(self):
         inputs = (
             ('foo', 'bar'), ('spam', 'eggs'),



More information about the Zope-Checkins mailing list