Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
validators.py: avoid spurious error messages after schema validation …
…fails If validation against the colander schema for the request fails, then request.validated is left empty - this will cause subsequent validation to fail for reasons that have nothing to do with what was submitted and returning the error messages to the user can be quite confusing. For example: if a new update is submitted with empty notes, not only does the user see 'Notes : Required', they also see 'Builds : You may not specify an empty list of builds.' and 'Builds : ACL validation mechanism was unable to determine ACLs.' - which are entirely spurious. In all validators that are run after the colander schema validator, check to see if a) request.validated is empty b) request.errors is non-empty, and in this case skip further validation. This is done as a decorator to have to avoid having dozens of separate code paths for validation-after-schema- failure that would need to be tested/covered. Signed-off-by: Owen W. Taylor <otaylor@fishsoup.net>
- Loading branch information
1 parent
6354367
commit 5241205
Showing
2 changed files
with
66 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters