Opened 9 years ago
Closed 9 years ago
#27373 closed Cleanup/optimization (fixed)
Incorrect message on 404 debug page for an empty request path
| Reported by: | Mariusz Felisiak | Owned by: | Mariusz Felisiak |
|---|---|---|---|
| Component: | Error reporting | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
If empty request path r'^$' is not in URL patterns, then message on 404 debug page is incorrect:
Using the URLconf defined in test_app.urls, Django tried these URL patterns, in this order:
^admin/
^__debug__/
The current URL, , didn't match any of these.
it should be (without double comma):
Using the URLconf defined in test_app.urls, Django tried these URL patterns, in this order:
^admin/
^__debug__/
The current URL, didn't match any of these.
Change History (7)
comment:1 by , 9 years ago
| Has patch: | set |
|---|
comment:2 by , 9 years ago
comment:3 by , 9 years ago
| Patch needs improvement: | set |
|---|---|
| Summary: | Incorrect message on 404 debug page → Incorrect message on 404 debug page for an empty request path |
| Triage Stage: | Unreviewed → Accepted |
I noticed this issue at one point and debated whether or not it was worth filing a ticket. It could be confusing, I guess.
comment:4 by , 9 years ago
Maybe sth like this:
<p> {% if request_path %} The current URL, <code>{{ request_path|escape }}</code>, {% else %} The empty URL {% endif %}didn't match any of these. </p>
will be better message.
comment:5 by , 9 years ago
| Patch needs improvement: | unset |
|---|
comment:6 by , 9 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Note:
See TracTickets
for help on using tickets.
Your fix for this case (https://github.com/django/django/pull/7420/files) is questionable, IMO.
If your goal is to help the user determine the URL that they attempted to resolve, the double comma at least helps visually enclose the space that's trying to be resolved.
I would suspect that this case is most common for new Django users. If this case is difficult enough to communicate, it may be worth it to come up with a better overall message.