Opened 4 years ago
Closed 4 years ago
#33433 closed Cleanup/optimization (fixed)
Avoid calling resolve() when unnecessary in technical_404_response
| Reported by: | Hrushikesh Vaidya | Owned by: | Hrushikesh Vaidya |
|---|---|---|---|
| Component: | Core (URLs) | Version: | 4.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
As discussed in the comments of this PR, we can avoid calling resolve(request.path) in the technical_404_response if request.resolver_match is already set.
This fix first checks if the resolver is None before calling resolve(), and avoids the call entirely if we have already resolved.
caller = ''
if resolver_match is None:
try:
resolver_match = resolve(request.path)
except Http404:
pass
if resolver_match is not None:
caller = resolver_match._func_path
Change History (4)
comment:1 by , 4 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 4 years ago
comment:3 by , 4 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Note:
See TracTickets
for help on using tickets.
PR