ANN: ClientForm 0.1.15 released (and 0.0.15, some time ago)

John J. Lee
09 Jan 2004 20:01:34 +0000

Changes from 0.1.10 to 0.1.15:

The following bugs were fixed in both 0.1.x and 0.0.x:

 * TEXTAREA contents are no longer .strip()ped on form parsing.
 * Fixed bugs where TEXTAREA or OPTION containing entity reference
   would result in truncated element contents.
 * A few doc fixes in HTMLForm.__doc__.
 * Fixed ImageControl.pairs(): return value contained integer
   coordinates instead of strings.
 * Empty OPTION no longer causes KeyError.
 * ClientForm.urlencode() works with Unicode.
 * Minor code clean-up.

The following bugs were fixed only in 0.1.x :

 * All form attributes are now available in HTMLForm.attrs
   (previously, name, action, method and enctype were not present).
 * ignore_errors is now ignored: not working, and a bad idea in the
   first place.
 * Take note of BASE element.

Requires Python >= 1.5.2.

ClientForm is a Python module for handling HTML forms on the client
side, useful for parsing HTML forms, filling them in and returning the
completed forms to the server.  It has developed from a port of Gisle
Aas' Perl module HTML::Form, from the libwww-perl library, but the
interface is not the same.

Simple example:

 from urllib2 import urlopen
 from ClientForm import ParseResponse

 forms = ParseResponse(urlopen(""))
 form = forms[0]
 print form
 form["author"] = "Gisle Aas"

 # returns a urllib2.Request object
 # (see HTMLForm.click_request_data.__doc__ if you're not using urllib2)
 response = urlopen("Thanks"))