Opened 2 days ago
Closed 40 hours ago
#36603 closed Cleanup/optimization (fixed)
Make LoginRequiredMiddleware avoid fetching request.user for public views
Reported by: | Adam Johnson | Owned by: | Adam Johnson |
---|---|---|---|
Component: | contrib.auth | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
LoginRequiredMiddleware checks request.user.is_authenticated
before view_func.login_required
. This causes unnecessary database queries for public views, fetching the current session and user, even though the check doesn't need that information. Rearranging the condition checks to first see if the view is public would avoid that extra work.
Change History (4)
comment:1 by , 2 days ago
Triage Stage: | Unreviewed â Accepted |
---|
comment:2 by , 2 days ago
Has patch: | set |
---|
comment:3 by , 40 hours ago
Triage Stage: | Accepted â Ready for checkin |
---|
comment:4 by , 40 hours ago
Resolution: | â fixed |
---|---|
Status: | assigned â closed |
Note:
See TracTickets
for help on using tickets.
In 41bc48a: