formalizeForm processing and validation | |
Download |
formalize Ranking & Summary
Advertisement
- License:
- BSD License
- Publisher Name:
- Oliver Cope
- Publisher web site:
- http://pesto.redgecko.org/
formalize Tags
formalize Description
Form processing and validation Formalize is a library designed to process and validate web form data cleanly and easily.A FormValidator object looks like this:>>> v = FormValidator(... firstname=Unicode(),... surname=Unicode(required="Please enter your surname"),... age=Int(greaterthan(18, "You must be at least 18 to proceed"), required=False),... )And can be applied to any data held in a dictionary-like object:>>> input_data = {... 'firstname': u'Fred',... 'surname': u'Jones',... 'age': u'21',... }>>> v.process(input_data){'age': 21, 'firstname': u'Fred', 'surname': u'Jones'}When validation fails, a ValidationError is raised. This contains error messages for all the failing validation tests:>>> input_data = {... 'firstname': u'Fred',... 'age': u'16',... }>>> v.process(input_data)Traceback (most recent call last): ...ValidationError: ValidationError() Requirements: · Python
formalize Related Software