Results 1 to 3 of 3

Thread: Meta refresh doesn't include GET

  1. #1
    Join Date
    Oct 2007
    Location
    Kentucky, USA
    Beans
    731
    Distro
    Ubuntu

    Meta refresh doesn't include GET

    I have a CGI server running with python as my language of choice. In it I have the following code:

    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
    Which is more important in obtaining the truth, "what" or "why"? Trick question. They are of equal importance.
    Freely ye have received, freely give.

  2. #2
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    1,913
    Distro
    Kubuntu 12.10 Quantal Quetzal

    Re: Meta refresh doesn't include GET

    I don't know this API, but =="None" shouldn't be ==None ?

  3. #3
    Join Date
    Jun 2009
    Location
    Land of Paranoia and Guns
    Beans
    194
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Meta refresh doesn't include GET

    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.
    Last edited by epicoder; April 20th, 2013 at 12:41 AM.
    Don't use W3Schools as a resource! (Inconsequential foul language at the jump)
    Open Linux Forums (More foul language, but well worth it for the quality of support and good humor.)
    If you want to discuss W3Schools, please PM me instead of posting.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •