PDA

View Full Version : Meta refresh doesn't include GET



ki4jgt
April 18th, 2013, 12:40 AM
I have a CGI server running with python as my language of choice. In it I have the following code:



if cgi.FieldStorage().getvalue("p") == "None":
print """<meta http-equiv="refresh" content="0; url=index.py?p=1">"""


However, I do not get redirected to index.py?p=1

ofnuts
April 18th, 2013, 11:34 AM
I don't know this API, but =="None" shouldn't be ==None ?

epicoder
April 20th, 2013, 12:38 AM
ofnuts is right. cgi.FieldStorage.getvalue returns the object None, not the string "None", if the value isn't found. You are effectively checking for index.py?p=None
Technically it should be == None (note the space) if you want to follow Python conventions. :P