Opened 12 years ago
Closed 11 years ago
#18373 closed Cleanup/optimization (fixed)
Thoroughly misleading error page when resolve() fails on a different URL
Reported by: | anonymous | Owned by: | Grzegorz Nosek |
---|---|---|---|
Component: | Core (URLs) | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | amirouche.boubekki@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I just spent a few hours tracking down a display bug in djangorestframework (https://github.com/tomchristie/django-rest-framework/pull/211).
This would have been *much* simpler if the debugging 404 error page hadn't been presenting this entirely irrelevant piece of information the whole time:
"The current URL, api/servers/, didn't match any of these."
As far as I can tell, the error page is getting that URL from the request's path_info attribute, when the real problem was that djangorestframework was doing "resolve(request.path)".
It would be better if the resolver set the URL it was trying to resolve on the Http404 exception object and the debugging error template retrieved it from there, rather than assuming that every 404 it is asked to display relates to the current page.
Change History (10)
comment:2 by , 12 years ago
Component: | Uncategorized → Core (URLs) |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:3 by , 12 years ago
Cc: | added |
---|
comment:4 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 12 years ago
Has patch: | set |
---|
comment:10 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
To reproduce, take any django view, add the following:
and observe the misleading debug page.
This will occur whenever a library calls
resolve()
with something other thanrequest.path_info
and the URL is not matched.