summaryrefslogtreecommitdiff
path: root/django/views/debug.py
diff options
context:
space:
mode:
authorHrushikesh Vaidya <hrushikeshrv@gmail.com>2022-01-12 12:23:09 +0530
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-01-12 08:23:38 +0100
commit18a15bbc9c7df19fe38f252bcd62d5a3811e3451 (patch)
tree00ef0394f78958e32259113ca04c86abaf266a9c /django/views/debug.py
parent75c1127eef23b32e787cd5dc97f7fa5ddb02bb9f (diff)
Fixed #33433 -- Avoided unnecessary resolve() calls in technical_404_response().
Thanks Keryn Knight for the initial patch.
Diffstat (limited to 'django/views/debug.py')
-rw-r--r--django/views/debug.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/django/views/debug.py b/django/views/debug.py
index cff199ddb4..29291c0bf6 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -537,11 +537,13 @@ def technical_404_response(request, exception):
urlconf = urlconf.__name__
caller = ''
- try:
- resolver_match = resolve(request.path)
- except Http404:
- pass
- else:
+ resolver_match = request.resolver_match
+ if resolver_match is None:
+ try:
+ resolver_match = resolve(request.path)
+ except Http404:
+ pass
+ if resolver_match is not None:
obj = resolver_match.func
if hasattr(obj, 'view_class'):