Improve tracking of error information in RepositoryForm.
Review Request #1535 — Created Jan. 18, 2019 and submitted
Information | |
---|---|
guest6774 | |
Review Board | |
07b1bc2... | |
Reviewers | |
demo | |
`RepositoryForm` can raise many different types of errors. Some are standard `ValidationError`s that are handled by the form. Some are attributes that get set that the template can render state from. None of these are really easily distinguished except by the contents of the error message, making them a bit useless outside of the form's internals and the front-end page. This change works toward improving `RepositoryForm` for usage outside of the admin page. We now have an error code associated with most types of `ValidationError`s, and we store the error raised during form validation so we can get to it later (a feature that newer versions of Django have natively, but we do not). The repository verification code now just worries about raising the errors, and the calling method stores those and translates them into the individual attributes. An upcoming change to the repository API will make use of this. Testing Done: Unit tests pass. Tested along with upcoming changes that make use of the new error codes. Reviewed at https://reviews.reviewboard.org/r/10375/