Overview

WTFridge

Introduction

A number of WTForms users have requested a number of customization features, from localization to easier-customizable errors, as well as other handy features.

The purpose of this project is a sandbox for testing various factory approaches to solving this without relying on instance globals For example, a validator registry might work as such::

v = Registry()
v.messages['Length-toosmall'] = _('%(field_name)s is too small. Must be at least %(min)s characters long')
name = TextField(validators=[v.Length()])

Planned Features

WTFridge plans to provide:
  • Easy solutions to replace validation errors en-masse for purposes of i18n.
  • Ways to define a custom message to be used in all future instances of a validator.
  • A way to define rules for replacing widgets, without boilerplate or excessive subclassing.
  • Handy field aliases, e.g. URLField is a TextField with validators.URL implied.

Installation

WTFridge requires WTForms.

To use, simply place wtfridge.py on your python path, or use your favorite installer-izer to install the tip as a python package.

License

WTFridge is released under the BSD License.