I've been talking a bit lately about web form form generation and validation, especially when combined with a framework to assist in data storage facilities. It turns out there's a lot of this going on in the Python world at the moment. Here's a list of kits that I could find. This is just a list. I've only glanced over documentation or source code (via ViewCVS) to most of these.
- Formulator is a Zope solution, and the one I've spent the most time with. Formulator's primary purpose is to define forms (usually through the web using Zope's management interface) and validate input. Formulator can be used to define the ordering and grouping of fields, and Zope's template facilities can be used to render the form and fields. For general purpose Zope use, Formulator does a great job. What I'd like to have is decent pre/post validation (ie - handling multiple fields) for the entire form that would tie into the main validation system. Formulator may be flexible enough in how it can be used to facilitate this in custom code that uses it.
- CMFFormController seems to be a Formulator type system targeted at the CMF (a special Zope framework for content management, and the engine behind Plone).
- FormEncode by Ian Bicking looks like it's intending to be a general purpose form/schema/validation toolkit. Ian previously worked on FunFormKit, which was meant to be used with Webware. FormEncode has some cool validation concepts. Some of these are the Compound Validators, which include a validator known as "Any", which supplies a list of validators. The first one to succeed stops the chain of validation for that data item. FormEncode looks like it's taking effort to be fairly agnostic to where its data is coming from or going to.
- formlib for SkunkWeb. I'm using SkunkWeb on this weblog, but only very lightly.
- Quixote's Form Framework, for the Quixote application server.
- FormKit, for Webware. This is "inspired by" FunFormKit mentioned above. This appears to be the preferred form kit for Webware at the time being, as Ian Bicking's moved on to his more generic FormEncode system (mentioned above). FormKit claims to be better integrated into the Webware response loop and easier to debug outside of a web environment than FunFormKit.
This is just a general overview of the basic toolkits available. Most of them are specific to particular frameworks or application servers, and remain fairly open to the issues of web form generation and validation. What you do with the data beyond that is up to you.
There are other systems available that tie themselves in to data management as well - that is, they provide not only data validation and display services, they tend to be tied into one or more persistence systems as well. A couple worth mentioning:
- zope.schema and zope.app.forms are principal Zope 3 elements. Schema are means of describing objects and are used with the
zope.interface
package to describe objects contractually. zope.app.forms
uses the Zope component framework to look up widgets that are displayed to HTML using zope.app.browser.forms
. The components in the zope.app
level do all of the HTML stuff, such as generating an edit form for an object based on a Schema (Interface), and saving the validated data to the object in question. It's also automatically tied into other Zope 3 services, such as the event framework. With it, one can create content objects and their interfaces (or custom implementations of other schemas) and build a full web user interface off of that data with a few lines of ZCML (Zope's Configuration Language) to loosely bind the edit form to instances of the content object. While there's a lot that can be done automatically, there's a lot of customization that can also be applied. Stock validation doesn't seem as strong as FormEncode. A lot of Zope 3's schema system is based on ideas espoused in the Naked Objects Framework.
- Archetypes for CMF / Plone. Archetypes seems targeted towards making custom content objects for Plone/CMF sites in a manner similar to what can be done with the Zope 3 zope.schema and zope.app.forms system. Archetypes also has a SQLStorage option to make custom objects that are managed in Zope/Plone but stored in an RDBMS in natural form. There are some interesting developments off of Archetypes:
- ArchGenXML - generates Archetype based Plone applications/products from XMI (UML) and XSD (XML Schema) files.
- There are fairly immediate plans to do stronger integration with Ape, a powerful abstract persistence system.
- Silva Metadata looks to be a Zope 2 implementation of a system similar to Zope 3's Annotations system, which allows customized extension (annotation) of existing Zope object types. It uses Formulator for form display and validation. There are some interesting signs in its roadmap about the future of Formulator. Of interest is "a bunch of improvements that separate out the conversion and validation code."
- ????. This one doesn't exist yet, but it's based on a couple of projects based on Formulator and building data storage components and chains of responsibility that span the gamut of user interface generation to data storage. Currently it's a collection of patterns. Soon it will be a Harvested Framework. What the libraries and frameworks mentioned in the first list allow is the ability to build these second kind - on top of the general form display and validation framework one can build a common framework to deal with what to do with that data - ie, a common way of displaying fields and errors, and being able to (in many cases) do automatic data saving (ie - cutting down on writing DML statements).