#8177 closed (fixed)
reverse() should report the reverse lookup that fails.
| Reported by: | mrts | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | Keywords: | reverse | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Now that {% url foo %} does not fail silently any more, it's really important to report which reverse lookup failed.
Compare:
Before the attached patch:
--------------------------
Django version 1.0-alpha_2-SVN-8255, using settings 'trunk.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
...
File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", line 291, in reverse
raise NoReverseMatch
NoReverseMatch
After the attached patch:
--------------------------
Django version 1.0-alpha_2-SVN-8255, using settings 'trunk.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
...
File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", line 291, in reverse
raise NoReverseMatch("Reverse for '%s' not found." % lookup_view)
NoReverseMatch: Reverse for 'foo-bar' not found.
Run a rgrep foo-bar . and you find the offending place easily.
Attachments (1)
Change History (5)
by , 17 years ago
| Attachment: | verbose_noreversematch.diff added |
|---|
comment:1 by , 17 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 17 years ago
Not strange at all, people will be hit by this all over Djangoland now that r8211 is in and there will be loud cries of "Help! I don't know which of my url tags is failing!" everywhere :).
I think that r8211 was a right thing though, I was able to catch an empty {% url %} I'd missed previously (but not before patching Django).
Note:
See TracTickets
for help on using tickets.
+1 on this! How strange, I was just about to file the same ticket with pretty much the same patch :)