Decision (if, else) routine is not working as intended with CGI module

Gabriel Genellina gagsl-py2 at
Wed Jan 30 00:28:44 CET 2008

En Tue, 29 Jan 2008 18:23:41 -0200, epsilon <cesmiga at> escribi�:

> I'm running into trouble figuring this one out.  It seems that my
> decision routine is not working as intended.  Does anyone know why my
> output continues to utilize the "else" portion of the routine.
> tag_form = cgi.FieldStorage(keep_blank_values=True)
> #if not tag_form.has_key("fse00"):
> if tag_form["fse00"] == "":

tag_form["fse00"] is a FieldStorage instance, not a string. To get its  
value, use:

if tag_form["fse00"].value == ""
if tag_form.getvalue("fse00")==""
if tag_form.getfirst("fse00")==""


Gabriel Genellina

More information about the Python-list mailing list