CGI question

Erik Max Francis max at alcyone.com
Tue Sep 17 23:14:58 CEST 2002


Ian Bicking wrote:

> Look at cgi.FieldStorage.  Something like:
> 
> f = cgi.FieldStorage(keep_blank_values=1)
> 
> Will save these values.  (I don't know why it isn't set by default...
> by
> default you shouldn't throw information away, but FieldStorage does in
> this case)

It actually is not unreasonable.  If form elements exist but are left
blank, such as a text field, they will appear in the form submission
even though you may not care about them.  Since when you're receiving a
form submission, presumably you know what elements were in the form, you
always know what to look for and can simply default to something
reasonable if it isn't present.

Note that what he's trying for is something different than a mere blank
value; a blank value would look something like `?blank=' whereas what
he's talking about is `?blank'.  I don't know offhand if
keep_blank_values will accept this form; I'm hoping you tested it before
suggesting it.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ It's like being on a diving board that you know is too high.
\__/ Sade Adu
    Kepler's laws / http://www.alcyone.com/max/physics/kepler/
 A proof of Kepler's laws.



More information about the Python-list mailing list