[Django] #31968: Handling of no auth backend failed

12 views
Skip to first unread message

Django

unread,
Aug 31, 2020, 9:32:37 AM8/31/20
to django-...@googlegroups.com
#31968: Handling of no auth backend failed
----------------------------------------+---------------------------
Reporter: jdnrg | Owner: nobody
Type: New feature | Status: new
Component: contrib.auth | Version: 2.2
Severity: Normal | Keywords: typecheck
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
----------------------------------------+---------------------------
The code here checks if the auth backends support the function signature,
and fails them if they do not match.
We are upgrading from 1.9 to 2.2 and encountered the issue that all the
backends failed the test and no exception was raised.
I would like to propose that we track which backends were tested in an
array and if that array size is zero that we raise an exception that no
backend could be found for verification, this would have saved us some
time.
For extra points, this test of the backend could be done at startup time
and the invalid plugins could be marked on starting django instead of
waiting for the time of usage. A static type check basically at load time
of all plugins for compatibility.

https://github.com/django/django/blob/dc39e62e6b652f006a77b91df02e1dc801597396/django/contrib/auth/__init__.py#L84

--
Ticket URL: <https://code.djangoproject.com/ticket/31968>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 1, 2020, 1:17:52 AM9/1/20
to django-...@googlegroups.com
#31968: Handling of no auth backend failed
-------------------------------------+-------------------------------------
Reporter: James Michael | Owner: nobody
(Mike) DuPont |
Type: New feature | Status: closed
Component: contrib.auth | Version: 2.2
Severity: Normal | Resolution: wontfix

Keywords: typecheck | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => wontfix
* easy: 1 => 0


Comment:

> We are upgrading from 1.9 to 2.2 and encountered the issue that all the
backends failed the test and no exception was raised.

You should always upgrade through each feature release incrementally (1.9
to 2.0 to 2.1 to 2.2) in such cases you wouldn't have missed deprecation
warning about the `authenticate()` signature.

> I would like to propose that we track which backends were tested in an
array and if that array size is zero that we raise an exception that no
backend could be found for verification, this would have saved us some
time.

I think it's not worth the complexity and a potential performance
regression (extra check when authenticating each user). You encountered
this issue because you try to bump few version at once, which
[https://docs.djangoproject.com/en/3.1/howto/upgrade-version/#required-
reading is not recommended].

> For extra points, this test of the backend could be done at startup time
and the invalid plugins could be marked on starting django instead of
waiting for the time of usage. A static type check basically at load time
of all plugins for compatibility.

[https://groups.google.com/g/django-developers/c/C_Phs05kL1Q/discussion
The Technical Board decided] to don't add static typechecking to Django.

--
Ticket URL: <https://code.djangoproject.com/ticket/31968#comment:1>

Reply all
Reply to author
Forward
0 new messages