Decision (if, else) routine is not working as intended with CGI module
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Jan 29 18:28:44 EST 2008
En Tue, 29 Jan 2008 18:23:41 -0200, epsilon <cesmiga at gmail.com> 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")==""
See http://docs.python.org/lib/module-cgi.html
--
Gabriel Genellina
More information about the Python-list
mailing list