Opened 3 years ago

Closed 3 years ago

#32842 closed Cleanup/optimization (fixed)

Refactor out a _check_token() method of CsrfViewMiddleware

Reported by: Chris Jerdonek Owned by: Chris Jerdonek
Component: CSRF Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This ticket is to refactor the following 40 lines of CsrfViewMiddleware.process_view():
https://github.com/django/django/blob/854e9b066850b9b4eb1171966e996322b2c16d27/django/middleware/csrf.py#L377-L417
into a new CsrfViewMiddleware._check_token() method, similar to how CsrfViewMiddleware._check_referer() was done in #32596. This would group together all of the token-related logic and further reduce the size of `process_view(), which is currently 90 lines long.

Change History (4)

comment:1 by Carlton Gibson, 3 years ago

Triage Stage: UnreviewedAccepted

OK, continuing the effort to make this more generally comprehensible +1. Thanks.

comment:3 by Chris Jerdonek, 3 years ago

Has patch: set

comment:4 by GitHub <noreply@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In ee408309:

Fixed #32842 -- Refactored out CsrfViewMiddleware._check_token().

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