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
sys.version_info
in the form (major version, minor version, revision, release candidate, status)
web.version
'0.4.0rc1'
web.name
web.date
'yyyy-mm-dd'
.
web.status
'beta'
Useful Objects
The web module provides the following objects:
web.cgi
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.FieldStorage
objects and a full functional specification.
Useful Functions
[type='text/html']) |
html[, mode='url']) |
'url'
the html string is encoded for use in a URL. If mode is 'form'
html is encoded for use in a form field.
Warning:
The HTTP protocol doesn't specify the maximum length of URLs but to be absolutely safe try not to let them be longer than 256 characters. Internet Explorer supports URLs of up to 2,083 characters. Any long strings are better off encoded to be put as hidden values in a form with method="POST"
rather than encoded and put in a link as they will then be sent in the HTTP header and there is no limit to their length. Creating links with huge amounts of text encoded in them may break result in strange results on different browsers.