Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#27053 closed Cleanup/optimization (fixed)

Document django.contrib.auth.get_user()

Reported by: Kevin Christopher Henry Owned by: Berker Peksag
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: berker.peksag@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


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)

comment:1 Changed 7 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by Berker Peksag

Cc: berker.peksag@… added
Has patch: set
Owner: changed from nobody to Berker Peksag
Status: newassigned

PR. get_user() was tested indirectly in a couple of places, but I added two simple tests. I didn't mention it's used by AuthenticationMiddleware.

comment:3 Changed 7 years ago by Tim Graham

Patch needs improvement: set

Documentation should be more descriptive as noted on the PR.

comment:4 Changed 7 years ago by Berker Peksag

Patch needs improvement: unset

comment:5 Changed 7 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In f7e91cac:

Fixed #27053 -- Documented contrib.auth.get_user().

comment:6 Changed 7 years ago by Tim Graham <timograham@…>

In a9fefd2:

[1.10.x] Fixed #27053 -- Documented contrib.auth.get_user().

Backport of f7e91cac689b28fc32ca52cdeac258ec0d58b4fc from master

Note: See TracTickets for help on using tickets.
Back to Top