summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-08-08 18:42:12 (GMT)
committerGuido van Rossum <guido@python.org>1996-08-08 18:42:12 (GMT)
commitafb5e93e779c7280309edb600aac40689df1fa8f (patch)
tree02e9242c692f1172a2c9ba2ccbf6c835734f0bfb
parent306a8a633800f2f37d054fbf48a3e0628faf3073 (diff)
downloadcpython-afb5e93e779c7280309edb600aac40689df1fa8f.zip
cpython-afb5e93e779c7280309edb600aac40689df1fa8f.tar.gz
cpython-afb5e93e779c7280309edb600aac40689df1fa8f.tar.bz2
For method=POST, append a query string from the environment or from
sys.argv[1], effectively merging the fields.
-rwxr-xr-xLib/cgi.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index 15af217..9fca4d8 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -439,6 +439,12 @@ def parse(fp=None, environ=os.environ, keep_blank_values=None):
qs = fp.read(clength)
else:
qs = '' # Unknown content-type
+ if environ.has_key('QUERY_STRING'):
+ if qs: qs = qs + '&'
+ qs = qs + environ['QUERY_STRING']
+ elif sys.argv[1:]:
+ if qs: qs = qs + '&'
+ qs = qs + sys.argv[1]
environ['QUERY_STRING'] = qs # XXX Shouldn't, really
elif environ.has_key('QUERY_STRING'):
qs = environ['QUERY_STRING']
@@ -961,7 +967,7 @@ class FormContentDict:
"""
def __init__(self, environ=os.environ):
- self.dict = parse(environ)
+ self.dict = parse(environ=environ)
self.query_string = environ['QUERY_STRING']
def __getitem__(self,key):
return self.dict[key]