cgi Module
Erik Max Francis
max at alcyone.com
Sat Feb 8 14:22:57 EST 2003
JS wrote:
> I have a question about the cgi module:
>
> I would like to write a robust cgi programm which checks all the
> parameters.
>
> Possible calls are:
>
> 1.) http://www.example.com/cgi-bin/test.py
> 2.) http://www.example.com/cgi-bin/test.py?param
> 3.) http://www.example.com/cgi-bin/test.py?param=
> 4.) http://www.example.com/cgi-bin/test.py?param=xyz
> 5.) param=file (POST)
>
> form = cgi.FieldStorage() gives me in cases 1+2+3 nothing?
By default, cgi.FieldStorage removes keys with blank values. If you
want them back, use cgi.FieldStorage(keep_blank_values=True)
> Shouldn't case 2 be param==None
> and case 3 param=="" ?
CGI makes no such distinction, so the best answer is probably no.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ So look into my eyes / I won't tell you lies
\__/ Neneh Cherry
Official Omega page / http://www.alcyone.com/max/projects/omega/
The official distribution page for the popular Roguelike, Omega.
More information about the Python-list
mailing list