[Zope3-checkins] SVN: Zope3/trunk/ Fixed issue #394: starting zope
with command -C arg
Dmitry Vasiliev
dima at hlabs.spb.ru
Mon Apr 11 08:57:00 EDT 2005
Log message for revision 29941:
Fixed issue #394: starting zope with command -C arg
causes request.form to contain '-C':''
Changed:
U Zope3/trunk/doc/CHANGES.txt
U Zope3/trunk/src/zope/publisher/browser.py
U Zope3/trunk/src/zope/publisher/tests/test_browserrequest.py
-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt 2005-04-10 14:45:14 UTC (rev 29940)
+++ Zope3/trunk/doc/CHANGES.txt 2005-04-11 12:56:59 UTC (rev 29941)
@@ -566,6 +566,9 @@
Bug Fixes
+ - Fixed issue #394: starting zope with command -C arg
+ causes request.form to contain '-C':''
+
- Fixed issue #387: apidoc and Cookie
- Fixed issue #334: Failing RuntimeInfo tests
Modified: Zope3/trunk/src/zope/publisher/browser.py
===================================================================
--- Zope3/trunk/src/zope/publisher/browser.py 2005-04-10 14:45:14 UTC (rev 29940)
+++ Zope3/trunk/src/zope/publisher/browser.py 2005-04-11 12:56:59 UTC (rev 29941)
@@ -247,6 +247,12 @@
else:
fp = None
+ # If 'QUERY_STRING' is not present in self._environ
+ # FieldStorage will try to get it from sys.argv[1]
+ # which is not what we need.
+ if 'QUERY_STRING' not in self._environ:
+ self._environ['QUERY_STRING'] = ''
+
fs = FieldStorage(fp=fp, environ=self._environ, keep_blank_values=1)
fslist = getattr(fs, 'list', None)
Modified: Zope3/trunk/src/zope/publisher/tests/test_browserrequest.py
===================================================================
--- Zope3/trunk/src/zope/publisher/tests/test_browserrequest.py 2005-04-10 14:45:14 UTC (rev 29940)
+++ Zope3/trunk/src/zope/publisher/tests/test_browserrequest.py 2005-04-11 12:56:59 UTC (rev 29941)
@@ -15,6 +15,7 @@
$Id$
"""
+import sys
import unittest
from zope.interface import implements, directlyProvides, Interface
@@ -33,6 +34,8 @@
from zope.publisher.tests.test_http import HTTPTests
from zope.publisher.publish import publish as publish_
+
+
def publish(request):
publish_(request, handle_errors=0)
@@ -384,6 +387,18 @@
verifyObject(IBrowserRequest, request)
verifyObject(IBrowserApplicationRequest, request)
+ def testIssue394(self):
+ extra = {'PATH_INFO': '/folder/item3/'}
+ request = self._createRequest(extra)
+ del request._environ["QUERY_STRING"]
+ argv = sys.argv
+ sys.argv = [argv[0], "test"]
+ try:
+ publish(request)
+ self.assertEqual(request.form, {})
+ finally:
+ sys.argv = argv
+
def test_suite():
loader = unittest.TestLoader()
return loader.loadTestsFromTestCase(BrowserTests)
More information about the Zope3-Checkins
mailing list