Fix Django 1.11 compatibility for auth validation methods.
Review Request #10837 — Created Jan. 19, 2020 and submitted
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.
Summary | ID |
---|---|
3665745f1b2ebe08a4875d4ae0be0880f445c0a6 |
- Change Summary:
-
- Removed an unused import.
- Updated the docstrings to better meet modern standards.
- Commits:
-
Summary ID fc38fe747d9662e980c1854e5bde92d0baac663e 3665745f1b2ebe08a4875d4ae0be0880f445c0a6 - Diff:
-
Revision 2 (+274 -32)