cgi Module

Mongryong Mongryong at sympatico.ca
Sat Feb 8 18:22:22 CET 2003


On Sat, 2003-02-08 at 12:12, JS wrote:
> Hi,
> 
> 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?
> 
> Shouldn't case 2 be param==None
> and case 3 param=="" ?
> 
Isn't this enough:

form = cgi.FieldStorage()
paramValue = None
if form.has_key('param'):
	paramValue = form['param'].value
doSomething(paramValue)







More information about the Python-list mailing list