Log message for revision 110441:
  Backported fix for LP #257675
  

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/ZPublisher/HTTPRequest.py
  U   Zope/branches/2.12/src/ZPublisher/tests/testHTTPRequest.py

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.12/doc/CHANGES.rst  2010-04-01 21:05:14 UTC (rev 110440)
+++ Zope/branches/2.12/doc/CHANGES.rst  2010-04-01 21:09:23 UTC (rev 110441)
@@ -31,6 +31,9 @@
 Bugs Fixed
 ++++++++++
 
+- LP #257675: request.form contained '-C':'' when no QUERY_STRING was in
+  the environment.
+
 - Zope 3-style resource directories would throw an Unauthorized error when
   trying to use restrictedTraverse() to reach a resource in a sub-directory
   of the resource directory.

Modified: Zope/branches/2.12/src/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/branches/2.12/src/ZPublisher/HTTPRequest.py    2010-04-01 21:05:14 UTC 
(rev 110440)
+++ Zope/branches/2.12/src/ZPublisher/HTTPRequest.py    2010-04-01 21:09:23 UTC 
(rev 110441)
@@ -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/branches/2.12/src/ZPublisher/tests/testHTTPRequest.py
===================================================================
--- Zope/branches/2.12/src/ZPublisher/tests/testHTTPRequest.py  2010-04-01 
21:05:14 UTC (rev 110440)
+++ Zope/branches/2.12/src/ZPublisher/tests/testHTTPRequest.py  2010-04-01 
21:09:23 UTC (rev 110441)
@@ -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'),

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to