1.1 web -- Web modules

The web module provides some basic utility functions and objects which are used throughout the Web Modules.

Version Information

The web module has the following variables:

web.version_info
A tuple similar to sys.version_info in the form (major version, minor version, revision, release candidate, status)
web.version
The version as a string eg '0.4.0rc1'
web.name
The name of the modules as a string
web.date
The date of the release as a string in the format 'yyyy-mm-dd'.
web.status
The release status of the code. For example 'beta'

Useful Objects

The web module provides the following objects:

web.cgi
An object based on the cgi.FieldStorage() object. The web.cgi object is the main way in which you will gain access to information. web.cgi provides a dictionary-like interface to all the sumbitted CGI variables. You should not create your own cgi.FieldStorage object because your versions may not contain all submitted information because creating a cgi.FieldStorage object can destroy data that would have been used in subsequent creations. By using the one web.cgi object you avoid this problem.

See Also:

cgi Module Documentation
The cgi module documentation distributed with Python has more information about cgi.FieldStorage objects and a full functional specification.

Useful Functions

encode( html)
Encode a string for use in an HTML document
html
The string to encode

header( [type='text/html'])
Returns a Content-type HTTP header
type
The content-type to output

See About this document... for information on suggesting changes.