Un(der)documented bits of cgi.py
Bob Kline
bkline at rksystems.com
Sun Sep 16 01:47:36 EDT 2007
I'm trying to detect and intelligently deal with problems created when a
user of a Python CGI page uploads a file and then gets impatient and
clicks on some other button or the browser's cancel button (or even
closes the page). If the file is large enough, and the user is
impatient enough, this can result in the FieldStorage.file object
getting some, but not all of the bytes from the user's file, with no
documented means of detecting that this has happened. Poking around in
the code for cgi.py in the standard library, it appears that there is an
undocumented 'done' attribute which might be useful here (it seems as if
it might get set to -1 when this condition is encountered), but of
course one is reluctant to leave behind software which relies on
undocumented behavior of packages, since those bits have a way of
disappearing in the middle of the night, suddenly breaking one's
software. Can anyone think of a good reason why it would not be
desirable to expose a publicly documented means of detecting the
condition described above?
Cheers and thanks!
Bob Kline
More information about the Python-list
mailing list