Document django.contrib.auth.get_user()
Essentially all the work of AuthenticationMiddleware
is done by django.contrib.auth.get_user(). For anyone who wants to customize this behavior (for example, fetching users on some requests but not others), then, this function is very helpful. It deals properly with error conditions and edge cases, and is what implements session invalidation on password change.
For that reason, I think this function should be documented and become a first-class part of the API.
Change History
(6)
Triage Stage: |
Unreviewed → Accepted
|
Cc: |
berker.peksag@… added
|
Has patch: |
set
|
Owner: |
changed from nobody to Berker Peksag
|
Status: |
new → assigned
|
Patch needs improvement: |
set
|
Patch needs improvement: |
unset
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
PR.
get_user()
was tested indirectly in a couple of places, but I added two simple tests. I didn't mention it's used byAuthenticationMiddleware
.