python cgi problem with method = post

Andrew Clover and-google at doxdesk.com
Sun Oct 5 11:51:14 EDT 2003


phil <interstar at postmaster.co.uk> wrote:

> So I take it that the first call to FieldStorage wipes out the data
> for any subsequent calls? Is this right?

This is the case with CGI in general, not specifically a Python thing. A
POSTed form submission is sent in the body of the HTTP request, which is
the 'standard input' stream for the script. You can only read the contents
of a stream once. With the cgi module, this reading occurs when
FieldStorage is constructed, so trying to make more than one FieldStorage
is generally a mistake.

I don't know why this might have worked locally - it shouldn't!

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/




More information about the Python-list mailing list