Skip to main content

Formalize: form processing and validation

Formalize is 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([('surname', 'Please enter your
surname'), ('age', 'You must be at least 18 to proceed')])

Documentation and download

Licensing

Formalize is available under the terms of the new BSD licence.

Changes

Version 0.1.1

  • Bugfix for ListValidator error reporting

Version 0.1.0

  • Initial public release

Metadata

Release files for formalize 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for formalize 0.1.1
File Size Uploaded
formalize-0.1.1.tar.gz 24.1 kB Details

Release files / formalize-0.1.1.tar.gz

Download URL formalize-0.1.1.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c2ab243afbdafd3c0f768a4d1a03a4298d29886a85a5f132ed7b34e97a48eac0
BLAKE2b-256 checksum
How to use checksums
8a18bab5f76ced1f5ced9dca2755fc228244591e28b40898b38a5c0aee61475f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

This release

0.1.1 This release

1 release file

0.1.0

1 release file

0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page