{{{
from django.contrib.auth.backends import ModelBackend
...
login(request, user, backend=ModelBackend)
}}}
which generated a very bizarre exception "Object of type 'type' is not
JSON serializable" from the sessions middleware with no backtrace leading
back to my code.
In the documentation for "Selecting the authentication backend", it says:
"the value of the backend argument or the user.backend attribute should be
a dotted import path string (like that found in AUTHENTICATION_BACKENDS),
not the actual backend class."
It would be nice to catch this, e.g., `assert isinstance(backend, str)`
closer to the site of the mistake.
--
Ticket URL: <https://code.djangoproject.com/ticket/29258>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => assigned
* owner: nobody => Abeer Upadhyay
--
Ticket URL: <https://code.djangoproject.com/ticket/29258#comment:1>
* has_patch: 0 => 1
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/29258#comment:2>
* needs_better_patch: 0 => 1
* type: New feature => Cleanup/optimization
--
Ticket URL: <https://code.djangoproject.com/ticket/29258#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"1bf4646f9133f26547a0dccf2f8a4526d85f2ab3" 1bf4646f]:
{{{
#!CommitTicketReference repository=""
revision="1bf4646f9133f26547a0dccf2f8a4526d85f2ab3"
Fixed #29258 -- Added type checking for login()'s backend argument.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29258#comment:4>