Commit Graph

49 Commits

Author SHA1 Message Date
Jeremy Hylton c253d9a623 Remove very long doc string (it's all in the docs)
Modify parse_qsl to interpret 'a=b=c' as key 'a' and value 'b=c'
(which matches Perl's CGI.pm)
2000-08-03 20:57:44 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Guido van Rossum 98d9fd3e68 Simple changes by Gerrit Holl - move author acknowledgements out of
docstrings into comments.
2000-02-28 15:12:25 +00:00
Guido van Rossum 3af7b050a3 Fix a broken r.append(name, value) call, spotted by Tim. 2000-02-25 11:44:03 +00:00
Guido van Rossum 60a3bd8130 After more discussion with Jim, change the behavior so that only a
*missing* content-type at the outer level of a POST defaults to
urlencoded.  In all other circumstances, the default is read_singe().
1999-06-11 18:26:09 +00:00
Guido van Rossum 1946f0d6f2 Patch by Jim Fulton: new function parse_qsl(), which is like
parse_qs() but returns a list of (name, value) pairs -- which is
actually more correct.  Use this where it makes sense.
1999-06-04 17:54:39 +00:00
Guido van Rossum ce900defc5 At Jim Fulton's request (actually, as a compromise :-), default the
content-type to application/x-www-form-urlencoded only when the method
is POST.  Ditto for when the content-type is unrecognized -- only
fall back to urlencoded with POST.
1999-06-02 18:44:22 +00:00
Barry Warsaw 302331a3b6 FieldStorage.__init__(): if there is no content-type header, use
text/plain for inner parts, but application/x-www-form-urlencoded
for outer parts.  Honor any existing content-type header.

Lower down, if the content-type header is something we don't
understand (say because it there was a typo in the header coming from
the client), default to text/plain for inner parts, but
application/x-www-form-urlencoded for outer parts.
1999-01-08 17:42:03 +00:00
Guido van Rossum 030d2ec16c In read_multi, allow a subclass to override the class we instantiate
when we create a recursive instance, by setting the class variable
'FieldStorageClass' to the desired class.  By default, this is set to
None, in which case we use self.__class__ (as before).
1998-12-09 22:16:46 +00:00
Guido van Rossum f5745008d2 Patch by Jim Fulton, who writes:
"""
The FieldStorage constructor calls the read_multi method.  The read_multi
method creates new FieldStorage objects, re-invoking the constructor
(on the new objects).  The problem is that the 'environ', 'keep_blank_values',
and 'strict_parsing' arguments originally passed to the constructor are not
propigated to the new object constructors.  This causes os.environ to be used,
leading to a miss-handling of the parts.

I fixed this by passing these arguments to read_multi and then on to the
constructor.  See the context diff below.
"""
1998-10-20 14:43:02 +00:00
Guido van Rossum 01852838f3 Treat "HEAD" same as "GET", so that CGI scripts won't fail. 1998-06-25 02:40:17 +00:00
Guido van Rossum cff311aa37 Be more careful than the previous patch. The default content-type
should only be set to application/x-www-form-urlencoded when the
method is POST.  E.g. for PUT, an empty default (defaulting to
text/plain later) makes more sense.
1998-06-11 14:06:59 +00:00
Guido van Rossum dd47ec98e2 Default content-type to application/x-www-form-urlencoded at the top
level of a form.  This means that browsers that omit the content-type
header when sending a POST command aren't penalized so heavily.
1998-06-09 19:49:16 +00:00
Guido van Rossum b1b4f94527 Make Tim O'Malley's requested change: in FieldStorage.__init__(), when
method='GET', always get the query string from environ['QUERY_STRING']
or sys.argv[1] -- ignore an explicitly passed in fp.
1998-05-08 19:55:51 +00:00
Guido van Rossum 45e2fbc2e7 Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
Guido van Rossum 00f9fea288 Use string.replace instead of regsub.[g]sub. 1997-12-24 21:18:41 +00:00
Guido van Rossum f15d15964b Use sys.exc_info() where needed. 1997-09-29 23:22:12 +00:00
Guido van Rossum a5e9fb6a65 Changes suggested by Jim fulton:
- Moved most imports to the top, for faster loadingf when using ni.
- Always open the temp file in binary mode.
1997-08-12 18:18:13 +00:00
Guido van Rossum 64c6620934 Add optional 'quote' flag argument to escape(); if true, translate '"'
to '"'.
1997-07-19 20:11:53 +00:00
Guido van Rossum d7c9d96d3e Tweak default source of query a bit so it is possible to invoke
a CGI script from the command line with not environment variables.
1997-05-28 15:39:15 +00:00
Guido van Rossum 4305542517 Reworded the doc string to remove the need for The Emacs font-lock kludge.
This required (re)moving all occurrences of '(' in column 0, as well
as changing "#!" to #!.
1997-05-28 15:11:01 +00:00
Guido van Rossum ad16471b27 Untested changes by Skip Montanaro to have an optional limit on the
size of uploads to POST (new version of these patches).
1997-05-13 19:03:23 +00:00
Guido van Rossum 5f32248d56 From: Clarence Gardner <clarence@king.silcom.com>
The function parse_qs currently calls urllib.unquote on the
value of the field submitted, but not on the name.  It needs
to do both.
1997-04-11 18:20:42 +00:00
Guido van Rossum 152f9d9663 Put back #! /usr/local/bin/python. For cgi scripts, /usr/bin/env is
unlikely to find a python binary, as /usr/local/bin is usually not on
the default search path.
1997-02-18 16:55:33 +00:00
Guido van Rossum 88b85d4f63 Add __len__ method 1997-01-11 19:21:33 +00:00
Guido van Rossum f06ee5fa07 /usr/local/bin/python -> /usr/bin/env python 1996-11-27 19:52:01 +00:00
Guido van Rossum e08c04c387 Added 'strict_parsing' option to all parsing functions. This causes a
ValueError exception when the query string contains fields that don't
contain exactly one '=' sign.  (By default, such fields are simply
ignored.)  Added this to the doc string describing parse() and
parse_qs().

Also changed the default for keep_blank_values from None to 0 (the
preferred way to spell 'FALSE').
1996-11-11 19:29:11 +00:00
Guido van Rossum 16d5b113f6 Fix truncated paragraph in doc string.
Bump version to 2.0.
1996-10-24 14:44:32 +00:00
Guido van Rossum c204c70c1a Added logging support. 1996-09-05 19:07:11 +00:00
Guido van Rossum e5e46e0d29 Fixed embarrassing logic bug in read_lines_to_outerboundary(). 1996-09-05 19:03:36 +00:00
Guido van Rossum 9e3f42909a Emacs font-lock de-bogo-kludgificocity 1996-08-26 15:46:13 +00:00
Guido van Rossum f85de8a440 Added print_exception() convenience function. 1996-08-20 20:22:39 +00:00
Guido van Rossum afb5e93e77 For method=POST, append a query string from the environment or from
sys.argv[1], effectively merging the fields.
1996-08-08 18:42:12 +00:00
Guido van Rossum 99aa2a4132 Remove all CRLF -> LF translation for file uploads, since we cannot
reliably distinguish binary files from text files (and Mac Netscape
sends all files in "binary" form, i.e. it sends text files with only
CR delimiters...).
1996-07-23 17:27:05 +00:00
Guido van Rossum 773ab27f04 Changes by Jim Fulton: pass environ around as arg;
keep_blank_values option to parse().
1996-07-23 03:46:24 +00:00
Guido van Rossum fa59cd73d4 bump version (sorry) 1996-05-28 22:58:15 +00:00
Guido van Rossum 503e50b0fa capitalize H3 headers; add 'cgi.' prefix to example code 1996-05-28 22:57:20 +00:00
Guido van Rossum a8738a5642 Added print_arguments() function. 1996-03-14 21:30:28 +00:00
Guido van Rossum 4032c2c1ce Change to use real temporary files instead of StringIO. Correct and
add to documentation.  This will be released as cgi.py 2.0a1.
1996-03-09 04:04:35 +00:00
Guido van Rossum 0147db07ef Considerable documentation changes and a few import rearrangements. 1996-03-09 03:16:04 +00:00
Guido van Rossum 7aee384dbc Reformatted with 4-space indentation. Added some quick docs to the
FieldStorage class.
1996-03-07 18:00:44 +00:00
Guido van Rossum 243ddcd7a9 Added FieldStorage class, which stores parts in files.
(Not documented yet, and the files are currently StringIO instances.)
1996-03-07 06:33:07 +00:00
Guido van Rossum 391b4e60e6 Reformatting only. 1996-03-06 19:11:33 +00:00
Guido van Rossum 7275561d34 File upload and revamped documentation. 1996-03-06 07:20:06 +00:00
Guido van Rossum 1c9daa8ba6 handle missing QUERY_STRING 1995-09-18 21:52:37 +00:00
Guido van Rossum e7808778d6 added parse_qs(query_string) 1995-08-07 20:12:09 +00:00
Guido van Rossum dcce73af48 fix typos in escape() and print_form() 1995-03-14 17:22:28 +00:00
Guido van Rossum eb9e9d2b2a layout changes; quote & as well 1995-02-27 13:16:11 +00:00
Guido van Rossum 9a22de101f new files 1995-01-12 12:29:47 +00:00