diff options
author | Guido van Rossum <guido@python.org> | 1997-05-28 15:39:15 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-05-28 15:39:15 (GMT) |
commit | d7c9d96d3ef86108e44eff751cc5d8639b38ea87 (patch) | |
tree | 0a2e4cd7ba4de8eae8a7fe8a7c36e24d4c218f85 /Lib | |
parent | 1aec3f087e46518f88027338b6b344dd3105699e (diff) | |
download | cpython-d7c9d96d3ef86108e44eff751cc5d8639b38ea87.zip cpython-d7c9d96d3ef86108e44eff751cc5d8639b38ea87.tar.gz cpython-d7c9d96d3ef86108e44eff751cc5d8639b38ea87.tar.bz2 |
Tweak default source of query a bit so it is possible to invoke
a CGI script from the command line with not environment variables.
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/cgi.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -783,17 +783,20 @@ class FieldStorage: If true, errors raise a ValueError exception. """ - method = None + method = 'GET' self.keep_blank_values = keep_blank_values self.strict_parsing = strict_parsing if environ.has_key('REQUEST_METHOD'): method = string.upper(environ['REQUEST_METHOD']) if not fp and method == 'GET': - qs = None if environ.has_key('QUERY_STRING'): qs = environ['QUERY_STRING'] + elif sys.argv[1:]: + qs = sys.argv[1] + else: + qs = "" from StringIO import StringIO - fp = StringIO(qs or "") + fp = StringIO(qs) if headers is None: headers = {'content-type': "application/x-www-form-urlencoded"} |