Don't pass request as an argument in template.render

(No direct bug-fix; but I'm being extra safe here.)

Prompted by the "shower thought" that made me wonder "why are the
ContextProcessors called for 500s / 400s _at all_? i.e. why is
getattr(request, "user", ...) like in 5907e49ce8 needed?

In fact, there was no explicit RequestContext in my code, but what
there was does seem to behave identically. And we don't actually need
`request` there, so better get rid of it.

Still, this doesn't mean we can turn the context-processors back into
their former unsafe (request.user) selves, because e.g. the 404 view
still passes through it.
This commit is contained in:
Klaas van Schelven
2024-12-22 22:10:07 +01:00
parent a5bc27032a
commit 4f05cd0ced

View File

@@ -145,7 +145,7 @@ def bad_request(request, exception, template_name=ERROR_400_TEMPLATE_NAME):
)
_, exception, _ = sys.exc_info()
return HttpResponseBadRequest(template.render({"exception": exception}, request))
return HttpResponseBadRequest(template.render({"exception": exception}))
@requires_csrf_token
@@ -164,4 +164,4 @@ def server_error(request, template_name=ERROR_500_TEMPLATE_NAME):
)
_, exception, _ = sys.exc_info()
return HttpResponseServerError(template.render({"exception": exception}, request))
return HttpResponseServerError(template.render({"exception": exception}))