Python CGI post problem

Paul Boddie paul at boddie.org.uk
Thu Nov 24 16:00:41 CET 2005


Eddy Ilg wrote:
> I'm having problems with a python cgi script. The script just won't read
> any POST data. Forms with GET data work fine.

[...]

> form=cgi.FieldStorage(keep_blank_values=True)

Since FieldStorage uses various defaults when you don't specify the fp
and environ parameters, it may be worth checking those defaults
(particularly what os.environ contains) to see if the FieldStorage
object gets incorrectly initialised. What you should be seeing in
os.environ is a value for "REQUEST_METHOD" of "POST" (or possibly
"post") - if not, FieldStorage will attempt to read the fields from the
QUERY_STRING environment variable, producing the results you've
observed.

Paul




More information about the Python-list mailing list