views:

38

answers:

1

I know that I am supposed to use cgi.FieldStorage for that. But what do I initialize it with?

def do_GET(self):
  form = cgi.FieldStorage(WHAT SHOULD BE HERE?!)

thanks!

I did search, but didn't find an answer :(

A: 

usually nothing!

form = cgi.FieldStorage() 

From the source

def __init__(self, fp=None, headers=None, outerboundary="",
             environ=os.environ, keep_blank_values=0, strict_parsing=0):
    """Constructor.  Read multipart/* until last part.

    Arguments, all optional:

    fp              : file pointer; default: sys.stdin
        (not used when the request method is GET)

    headers         : header dictionary-like object; default:
        taken from environ as per CGI spec

    outerboundary   : terminating multipart boundary
        (for internal use only)

    environ         : environment dictionary; default: os.environ

    keep_blank_values: flag indicating whether blank values in
        URL encoded forms should be treated as blank strings.
        A true value indicates that blanks should be retained as
        blank strings.  The default false value indicates that
        blank values are to be ignored and treated as if they were
        not included.

    strict_parsing: flag indicating what to do with parsing errors.
        If false (the default), errors are silently ignored.
        If true, errors raise a ValueError exception.

    """
gnibbler
So what does that mean?...
Evgeny
I mean, yes usually nothing. But if it's in a do_GET of HTTPRequestHandler I have to give it something, since global variables have no information on the form.
Evgeny