• Nick Stenning's avatar
    Support reporting top-level form validation errors · e13040b9
    Nick Stenning authored
    When we call `form.validate()` and the validation fails, the raised
    exception is a `deform.ValidationFailure`. This object has an `error`
    attribute which represents the underlying validation error object for
    the entire form.
    
    Previously, if the validation failure were a result of top-level
    validation errors (such as the fact that an unactivated user is trying
    to log in), this error would be lost, because we only reported errors
    for the forms fields, or "children".
    
    This commit changes `h.accounts.views.validate_form` so that it converts
    the entire `colander.Invalid` object into a dictionary using its
    `asdict()` instance method. By doing this, we get two immediate
    benefits:
    
    - top-level validation errors are reported in the '' (empty string)
      field
    - we avoid the need to aggregate form field errors by hand in ajax_form
    
    In addition, we need to deal with this case on the frontend, so this
    commit also changes the formRespond directive so that if no overall
    "reason" is provided for failure, then an empty-string member of the
    "errors" object can set the overall validation status (and error
    message) for the form.
    e13040b9
Name
Last commit
Last update
..
account Loading commit data...
annotator Loading commit data...
config Loading commit data...
directive Loading commit data...
filter Loading commit data...
test Loading commit data...
vendor Loading commit data...
.gitignore Loading commit data...
annotation-mapper.coffee Loading commit data...
annotation-sync.coffee Loading commit data...
annotation-ui-controller.coffee Loading commit data...
annotation-ui-sync.coffee Loading commit data...
annotation-ui.coffee Loading commit data...
annotation-viewer-controller.coffee Loading commit data...
app-controller.coffee Loading commit data...
app.coffee Loading commit data...
auth.coffee Loading commit data...
blocklist.js Loading commit data...
bridge.coffee Loading commit data...
cross-frame.coffee Loading commit data...
discovery.coffee Loading commit data...
drafts.coffee Loading commit data...
flash.coffee Loading commit data...
form-respond.coffee Loading commit data...
host.coffee Loading commit data...
identity.coffee Loading commit data...
karma.config.js Loading commit data...
local-storage.coffee Loading commit data...
permissions.coffee Loading commit data...
pulse.coffee Loading commit data...
query-parser.coffee Loading commit data...
render.coffee Loading commit data...
search-filter.coffee Loading commit data...
session.coffee Loading commit data...
store.coffee Loading commit data...
stream-controller.coffee Loading commit data...
stream-filter.coffee Loading commit data...
streamer.coffee Loading commit data...
tags.coffee Loading commit data...
threading.coffee Loading commit data...
time.coffee Loading commit data...
unicode.coffee Loading commit data...
view-filter.coffee Loading commit data...
widget-controller.coffee Loading commit data...