1. Home
  2. Computing & Technology
  3. Python

Programming CGI With Python

From Al Lukaszewski, for About.com

3 of 4

Attributes of FieldStorage

Every instance of class FieldStorage (e.g., 'form') has the following attributes:

    form.name The name of the field, if it is specified
    form.filename If an FTP transaction, the client-side filename
    form.value The value of the field as a string
    form.file file object from which data can be read
    form.type The content type, if applicable
    form.type_options The options of the 'content-type' line of the HTTP request, returned as a dictionary
    form.disposition The field 'content-disposition'; None if unspecified
    form.disposition_options The options for 'content-disposition'
    form.headers All of the HTTP headers returned as a dictionary [/blockquote]

    So, instead of writing above

    name = form.getvalue('name')
    I could have written
    name = form['name'].value

Explore Python
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Python
  4. Web Development
  5. Python CGI - Attributes of FieldStorage When Programming Python's CGI

©2009 About.com, a part of The New York Times Company.

All rights reserved.