ANN: ClientForm 0.2.2 released

John J Lee jjl at pobox.com
Thu Mar 23 00:32:45 CET 2006


http://wwwsearch.sourceforge.net/ClientForm/

This is the first stable release of ClientForm 0.2.

(See below for the list of changes since 0.2.1b.)

Many improvements have been made as part of the 0.2 release, thanks
largely to Gary Poster, Benji York and their employer Zope Corporation
as part of their work on zope.testbrowser.  These include:

* 0.1 backwards compatibility mode (backwards_compat switch).
* Greatly improved support for labels, including control labels.
* Added first-class support for list items and labels.
* A few methods have been added, and many superfluous methods
   deprecated.
* The example script on the web page / README.html is now an
   executable script in the examples directory, that runs against a
   test page on the wwwsearch.sourceforge.net site.
* Label matching is now by substring (after compression of
   whitespace), not by exact string equality.
* Support for list item ids.
* Finding controls or items now raises AmbiguityError if no nr
   argument is supplied and the other arguments do not uniquely
   identify the control or item.  The old behaviour is restored by
   passing nr=0.
* Fix multiple identical list item behaviour.
* Fixed a bug where disabled list items were successful (got sent back
   to the server).
* More intuitive disabled list item behaviour.
* Large sections of the module have been reimplemented using classes
   Item and Label, making for better code.
* Added ListControl.get(), ListControl.get_items(),
   HTMLForm.set_value_by_label(), and HTMLForm.get_value_by_label()
   methods.
* Applied patch from Titus Brown to add .clear() method to all
   Controls.
* The following ListControl methods have been deprecated:
   possible_items
   get_item_attrs
   set_item_disabled
   get_item_disabled
   set_single
   toggle_single
   set
   toggle
* The following HTMLForm methods have been deprecated:
   possible_items
   set_single
   toggle_single
   set
   toggle
* The by_label argument of the following methods has been deprecated:
   get_value
   set_value
* Added support for setuptools / EasyInstall / Python Eggs.
* Make entitydefs more sane.  Expose entitydefs in ParseFile /
   ParseResponse functions.


Changes since 0.2.1b:

* Fixes to setup.py &c.
* Follow IE and Firefox on algorithm for choosing MIME boundary --
   servers are buggy on this.
* Fix POST multipart/form-data parameter ordering (patch from
   Balazs Ree) and ImageControl ordering.
* Fix .fixup() of disabled select with no selected options (John
   Wayne).
* Encoding fixes.
* Add BeautifulSoup support (not yet well tested).
* Switch from htmllib to sgmllib.
* Add form name to str(HTMLForm).
* Make parser debugging a bit easier.


Requires Python 2.0 or newer.

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 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("http://www.example.com/form.html"),
                       backwards_compat=False)
form = forms[0]
print form
form["author"] = "Gisle Aas"

# form.click() returns a urllib2.Request object
# (see HTMLForm.click.__doc__ if you don't have urllib2)
response = urlopen(form.click("Thanks"))


John


More information about the Python-announce-list mailing list