summaryrefslogtreecommitdiffstats
path: root/Lib/cgi.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-09-18 21:52:37 (GMT)
committerGuido van Rossum <guido@python.org>1995-09-18 21:52:37 (GMT)
commit1c9daa8ba685f17fe2c41aafae66beee808e6fc7 (patch)
tree6810d799d672450941481bd9da613bae53085406 /Lib/cgi.py
parent3b7b8131a618bf7ad4aa8c5608a9853ae9539d3a (diff)
downloadcpython-1c9daa8ba685f17fe2c41aafae66beee808e6fc7.zip
cpython-1c9daa8ba685f17fe2c41aafae66beee808e6fc7.tar.gz
cpython-1c9daa8ba685f17fe2c41aafae66beee808e6fc7.tar.bz2
handle missing QUERY_STRING
Diffstat (limited to 'Lib/cgi.py')
-rwxr-xr-xLib/cgi.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index f146dc9..6b4f859 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -1,4 +1,13 @@
#!/usr/local/bin/python
+
+# XXX TODO
+# - proper doc strings instead of this rambling dialogue style
+# - more utilities, e.g.
+# - print_header(type="test/html", blankline=1) -- print MIME header
+# - utility to format a nice error message in HTML
+# - utility to format a Location: ... response, including HTML
+# - utility to catch errors and display traceback
+
#
# A class for wrapping the WWW Forms Common Gateway Interface (CGI)
# Michael McLay, NIST mclay@eeel.nist.gov 6/14/94
@@ -47,8 +56,10 @@ def parse():
if environ['REQUEST_METHOD'] == 'POST':
qs = sys.stdin.read(string.atoi(environ['CONTENT_LENGTH']))
environ['QUERY_STRING'] = qs
- else:
+ elif environ.has_key('QUERY_STRING'):
qs = environ['QUERY_STRING']
+ else:
+ environ['QUERY_STRING'] = qs = ''
return parse_qs(qs)