diff options
| author | Hrushikesh Vaidya <hrushikeshrv@gmail.com> | 2022-01-12 12:23:09 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-01-12 08:23:38 +0100 |
| commit | 18a15bbc9c7df19fe38f252bcd62d5a3811e3451 (patch) | |
| tree | 00ef0394f78958e32259113ca04c86abaf266a9c /django/views/debug.py | |
| parent | 75c1127eef23b32e787cd5dc97f7fa5ddb02bb9f (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.py | 12 |
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'): |
