API Reference¶
- class pyramid_uniform.Form(request, schema, method='POST')[source]¶
-
- method_allowed[source]¶
Is the method that was used to submit this form allowed?.
If this form doesn’t have a request method set (i.e., if it was explicitly set to None), any method is valid. Otherwise, the method of the form submission must match the method required by this form.
- validate(skip_csrf=False, assert_valid=False)[source]¶
Validate a form submission.
When assert_valid is False (the default), a bool will be returned to indicate whether the form was valid. (Note: this isn’t strictly true–a missing or bad CSRF token will result in a immediate 400 Bad Request response).
When assert_valid is True, certain conditions will be assert``ed. When an assertion fails, the resulting ``AssertionError will cause an internal server error, which will in turn cause an error email to be sent out.
- exception pyramid_uniform.FormInvalid(*args, **kw)[source]¶
Raised when form data is used but the form is not valid.
- message = 'Form is invalid'¶
- exception pyramid_uniform.FormNotValidatedError(*args, **kw)[source]¶
Raised when form data is used before form has been validated: for example, when form.bind() is called.
- message = 'Form has not been validated; call validate() first'¶
- class pyramid_uniform.FormRenderer(form, csrf_field='_authentication_token', id_prefix=None)[source]¶