How to use the klein.Form.onValidationFailureFor function in klein

To help you get started, we’ve selected a few klein examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twisted / klein / docs / introduction / codeexamples / forms.py View on Github external
    style.routed(Form.onValidationFailureFor(postHandler),
                 [tags.h1('invalid form'),
                  tags.div(slot('the-invalid-form'))]),
    renderer=Form.rendererFor(postHandler, action=u"/?post=yes"),
)
def validationFailed(values, renderer):
    renderer.prevalidationValues = values.prevalidationValues
    renderer.validationErrors = values.validationErrors
    return {'the-invalid-form': renderer}