Fix Django 1.11 compatibility for auth validation methods.
Review Request #10837 — Created Jan. 19, 2020 and submitted — Latest diff uploaded
djblets.auth.util.validate_test_cookie()
was using an old module
location forErrorList()
, used for form errors. We had a couple
imports at the top of the module that were designed to locate the
correct version of this forvalidate_old_password
, but
validate_test_cookie
wasn't using it.A more correct approach, which this change implements, is to use the
provided form'serror_class
attribute instead, which defaults to
ErrorList
but could be something more specific on some forms. This
simplifies our code, since we don't have to guess where the class is,
and ensures we work with more form implementations.Unit tests were added for the validation methods to ensure they work in
all Django versions.
Unit tests pass on Django 1.7 and 1.11.