Un(der)documented bits of cgi.py

Aahz aahz at pythoncraft.com
Mon Sep 17 10:53:04 EDT 2007


In article <mLadnSK4GYnlXnHbnZ2dnUVZ_q2hnZ2d at speakeasy.net>,
Bob Kline  <bkline at rksystems.com> wrote:
>
>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?

What I suggest doing is submitting a doc patch to 
http://bugs.python.org/
explaining the ``done`` attribute with a note that you're not sure
whether the attribute is intended to be undocumented.  Alternatively, you
might look in the svn logs to find out who added the ``done`` attribute
and if they're still active in the Python community, ask them directly.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

The best way to get information on Usenet is not to ask a question, but
to post the wrong information.



More information about the Python-list mailing list