Atocha 1.0 reviewDownload
Atocha is a Python package for parsing and rendering data from web forms. Atocha is framework-agnostic, generic, and it should be po
Atocha is a Python package for parsing and rendering data from web forms.
Atocha is framework-agnostic, generic, and it should be possible to use it with CGI scripts or to incorporate it in your favourite web application framework.
Just before I decided to write this software (2005-09-30), I had the following problems:
- There was no library that could parse input from widgets and perform automatic types conversions reliably, that was both decent and simple, or that was not tied to a specific web application framework. (A few options were starting to sprout and mature around that time, such as FormEncode);
- I was having lots of trouble in the various data paths of my handlers with type conversions, often having unicode encoding problems;
- I felt that the problem of handling and rendering web forms were really tied closely, and that it could be solved in a generic manner.
At the time, I had written my own web application framework, and a small form library I had copied from somewhere had grown into a messy monster. So I decided to attack the problem directly and rewrite my forms handling generically, with the following goals in mind:
- Reuse the form definition for parsing submitted arguments as well as rendering and displaying data (leverage the knowledge stored in the form definition as much as possible);
- Robustness: an emphasis on strict type checking and robustness via tests;
- Fields automatically perform appropriate type conversion when returning the parsed value to the user; Like desktop UI toolkit widgets, fields may return all sorts of data types. Also, fields can use multiple HTML input widgets, the notion of input and its mechanism are separate.
Essentially, I wanted functionality closer to what desktop UI toolkits provide, which is often not present in web form parsing toolkits.
Here are some key features of "Atocha":
Generic library that is possible to reused in many frameworks and applications. It is not tied to any storage model or domain model, this library provides the data, and you must then store the data yourself. This makes sense, as user-interfaces may change but the underlying data model remain the same;
Extensible: it is easy to create and add new field types without having to modify the framework. It is also possible to create renderers for your favourite output library (e.g. Stan)
Fields may render to multiple input widgets and are consolidated in a single value automatically;
Internationalization (I18n) of all messages is supported (all messages generated by the library are grouped in a s single place and can be easily customized);
Supports hidden, disabled, and read-only widgets that can be used for implementing multiple-page forms;
Supports per-field errors, to be rendered next to the erroneous widgets;
Supports a UI message and status for the re-rendering a form with errors;
Atocha 1.0 search tags