Opened 8 years ago

Closed 8 years ago

Last modified 8 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

Description

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 by Tim Graham, 8 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Berker Peksag, 8 years ago

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 by Tim Graham, 8 years ago

Patch needs improvement: set

Documentation should be more descriptive as noted on the PR.

comment:4 by Berker Peksag, 8 years ago

Patch needs improvement: unset

comment:5 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In f7e91cac:

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

comment:6 by Tim Graham <timograham@…>, 8 years ago

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