Improve tracking of error information in RepositoryForm.
Review Request #10375 — Created Jan. 4, 2019 and submitted — Latest diff uploaded
RepositoryFormcan raise many different types of errors. Some are
ValidationErrors 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
RepositoryFormfor usage outside of
the admin page. We now have an error code associated with most types of
ValidationErrors, 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.
Unit tests pass.
Tested along with upcoming changes that make use of the new error codes.