Methods

Class: Form

Translator of user input into Python values.

Forms translate a MultiDict of user input to a dict of validated Python values suitable for safe use by an application. A form is composed by any number of fields, and each field is assigned a key. This key is where the field's translated value is stored in the resulting dict.

Forms may also have any number of validators to enforce higher-order constraints across multiple fields. Validators execute after the form's fields have been translated. Validators execute even if one or more fields raise TranslationError, though any offending field is omitted from their input. (Because of this, most validators skip validation if one or more expected value is missing.)

Methods

translate (self, input)

Return a dict of valid Python values translated from a MultiDict of user input. Raise ErrorSet if one or more field raises TranslationError, or if any validator raises ValidationError.