#36603: Make LoginRequiredMiddleware avoid fetching request.user for public
views
-------------------------------------+-------------------------------------
Reporter: Adam | Owner: Adam Johnson
Johnson |
Type: | Status: assigned
Cleanup/optimization |
Component: | Version: dev
contrib.auth |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/36603>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701993590cf05-9f213ebf-ed97-45b8-b3c7-bd69b158cc54-000000%40eu-central-1.amazonses.com.