The form module

form is an (incompatible) alternative to the cgi module from the standard Python distribution.

form is intended to make it easier to write robust CGI scripts, making your code clearer and reducing the amount of type- and error-checking you have to do with cgi. It supports all HTML form functions, including multiple-file-upload and imagemap-input, and has in-built Denial of Service safeguards. It has utility functions you'll use a lot when writing CGIs, and can also output url-encoded and multipart/form-data for sending to servers.

It has been used on production Apache and IIS webservers and with the PyApache and (with some glue) mod_python modules; it should also work with any standard-CGI-capable server. It is compatible with Python 1.5 upwards (and has tested up to version 2.3).

form is not intended to be a web application framework. It does not provide sessions, templating or a object model you have to code to. It only deals with form encoding and decoding — the architecture of your scripts remains up to you. See the documentation for example usage.


Version 1.9 [final]: module, documentation. Licence: new-BSD.

This is intended to be the last release before a substantial rewrite and extension of the ideas behind

All released versions

1.9 [final] 2004-06-07 module docs
1.8 [final] 2003-07-10 module docs
1.7 [final] 2003-04-26 module docs
1.6 [final] 2003-04-17 module docs
1.5 [final] 2002-10-08 module docs
1.4 [beta] 2002-05-07 module docs
1.3 [final] 2002-04-11 module docs
1.2 [final] 2001-01-29 module docs
1.1 [beta] 2000-12-21 module docs
1.0 [final] 2000-12-07 module docs
0.7 [beta] 2000-06-15 module
0.6 [dogfood] 2000-06-11 module