]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
handle missing QUERY_STRING
authorGuido van Rossum <guido@python.org>
Mon, 18 Sep 1995 21:52:37 +0000 (21:52 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 18 Sep 1995 21:52:37 +0000 (21:52 +0000)
Lib/cgi.py

index f146dc99e524c7b01e3fc2a52c7ecd1de240523b..6b4f859f65bdf04982e0eb38cd0731bc752c6bb0 100755 (executable)
@@ -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)