MCPcopy
hub / github.com/django/django / process_request

Method process_request

django/middleware/csrf.py:401–412  ·  view source on GitHub ↗
(self, request)

Source from the content-addressed store, hash-verified

399 raise RejectRequest(reason)
400
401 def process_request(self, request):
402 try:
403 csrf_secret = self._get_secret(request)
404 except InvalidTokenFormat:
405 _add_new_csrf_cookie(request)
406 else:
407 if csrf_secret is not None:
408 # Use the same secret next time. If the secret was originally
409 # masked, this also causes it to be replaced with the unmasked
410 # form, but only in cases where the secret is already getting
411 # saved anyways.
412 request.META["CSRF_COOKIE"] = csrf_secret
413
414 def process_view(self, request, callback, callback_args, callback_kwargs):
415 if getattr(request, "csrf_processing_done", False):

Calls 2

_get_secretMethod · 0.95
_add_new_csrf_cookieFunction · 0.85