CGI scripts should *not* use /usr/bin/env, since on systems that don't
come standard with Python installed, Python isn't on the default $PATH.
Too bad that this breaks on Linux, where Python is in /usr/bin which
is on the default path -- the point is that you must manually edit
your CGI scripts when you install them.
style conventions. (Ping has checkin privileges but apparently
ignores them at the moment.)
Ping improves a few doc strings and fixes style violations like foo ( bar ).
An addition of my own: rearrange the printing of various items in
test() so that the (long) environment comes at the end. This avoids
having to scroll if you want to see the current directory or command
line arguments.
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 ;)
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.
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.
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).
"""
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.
"""
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.
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').
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...).