Change in cgi module's handling of POST requests

Joshua Kugler joshua at
Thu Feb 12 22:22:15 CET 2009

Bob Kline wrote:

> [Didn't realize the mirror didn't work both ways]
> We just upgraded Python to 2.6 on some of our servers and a number of our
> CGI scripts broke because the cgi module has changed the way it handles
> POST requests.

> When the 'action' attribute was not present in the form 
> element on an HTML page the module behaved as if the value of the
> attribute was the URL which brought the user to the page with the form,
> but without the query (?x=y...) part.

This does not make sense.  Can you give an example?  When you POST, the
attributes are not appended to the URL, but form encoded.

> Now FieldStorage.getvalue () is 
> giving the script a list of two copies of the value for some of the
> parameters (folding in the parameters from the previous request) instead
> of the single string it used to return for each.

There is a function call to get only one value.  I think it's get_first() or
some such.

Well, the CGI module hasn't had many changes.  There was this bug fix a few
months back:

Diff to previous:

For all revisions:

It is possible that by fixing a bug, they brought the behavior in line with
what it *should* be.  Or maybe the browser behavior changed?  The server
does not care about an "action" attribute.  That only tells the browser
where to send the data.  It is possible the browser did not properly format
a request when there was no "action" attribute. Can you provide more


More information about the Python-list mailing list