Version 0.2.0 of Yann’s Yet Another Form Library is now available for download. I have been using this code in product for at least a month and felt it is pretty stable. You can grab it from the main site at stackfoundry.com or from the PyPI page.
yyafl is a partial reimplementation and adaptation of the Django ‘newforms’ library allowing it to exist outside of the Django infrastructure. It can be used in other frameworks such as CherryPy and Pylons. YYAFL provides:
- Pluggable and skinnable forms, use either pure Python code or a compatible templating engine (such as Mako). Attach on the fly decorators (such as the ubiquitous red star to required form fields) or even apply whole layouts to forms.
- Default properties can be added to the form object – for example, a default rendering layout can be chosen.
- Comprehensive validation framework for many data types (which is easy to grow, similar in style to newforms)
- Comprehensive widget collection, which is easy to grow, tweak, or extend for your application’s needs. (currently doesn’t support multi-widgets well, this wart will be fixed soon however)
- Soon! Automatic CSRF managed forms – pass it a session store object and it can handle the rest by preventing cross site requests.
YYAFL uses some large chunks of the form-model and metaclass system that newforms used, and as such uses the same license as Django. Work is being done to refactor portions of this code to add some flexibility for multi-widget data fields (such as Date being split amongst several form fields), which were somewhat unclean in Django’s implementation.