Change in cgi module's handling of POST requests

Bob Kline bkline at rksystems.com
Tue Feb 10 21:19:59 CET 2009


[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.  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.  I searched this newsgroup looking for a discussion of the proposal to impose this change of behavior, and perhaps I wasn't using the right phrases in my search, but I didn't find anything.  I see that Perl still behaves the way pre-2.6 Python used to (not that I view that as a reason for anything).  We'll work around the breakage by explicitly setting the 'action' attribute everywhere, of course, but I usually see some discussion (often heated) of the impact of behavior changes on existing software when something like this is in the works.  Did I miss it?

I also noted that the module is making some deprecated use of the BaseException class.

Cheers.






More information about the Python-list mailing list