#8221 closed (fixed)
NoReverseMatch should not swallow ImportError/AttributeError
Reported by: | eibaan | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In django.core.urlresolver.reverse
around line 200, NoReverseMatch
is raised without further details. Please provide more details to help debugging. In case of import or attribute errors, please provide the original exception and do not swallow it.
Attachments (4)
Change History (14)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
This should have been fixed in [8272]. Try with a more recent version of trunk.
If an exception is raised at that point, it's because the given view name could not be matched against the registered URLs.
Reopen this ticket if you estimate that the information given in the exception message -- basically, the unmatched view name -- is still not enough for debugging.
comment:3 by , 16 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
[8272] fixed two occurences of NoReverseMatch
near line 291. Near line 200, there are two more occurences. Furthermore, it would be helpful to get access to the root cause (attribute or import error). I might be wrong, but "not a callable" is just a guess. For example, it could also be a syntax error in a Python file or a missing file that causes the import error.
by , 16 years ago
Attachment: | improved_exceptions_for_reverse.diff added |
---|
by , 16 years ago
Attachment: | improved_exceptions_for_reverse2.diff added |
---|
Reverse minor needless whitespace change in previous patch
comment:4 by , 16 years ago
Has patch: | set |
---|---|
milestone: | → 1.0 |
Triage Stage: | Unreviewed → Accepted |
eibaan is right, I just scratched the place where it itched when I submitted the patch that was merged in r8272. Should have looked around.
comment:5 by , 16 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
Looks like a dupe of #7524.
comment:6 by , 16 years ago
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
ubernostrum, this is a different issue than what's reported at #7524. Please look at the patch.
by , 16 years ago
Attachment: | improved_exceptions_for_reverse_with-args.diff added |
---|
Make 'Reverse for foo not found' more useful by showing the arguments as well. This really helps to fix problems in real life.
comment:7 by , 16 years ago
Justification for change in last patch:
in one of my projects, some articles had somehow invalid slugs (with spaces, I actually wonder how this is possible -- SlugField shouldn't allow saving these), so, of course I got 'Reverse for foo not found' for the article view. It took me a while to find out what's wrong. With this patch, I could instantly spot the problem.
by , 16 years ago
Attachment: | improved_exceptions_for_reverse_with-args_updated-AUTHORS.diff added |
---|
Adding myself to AUTHORS
comment:8 by , 16 years ago
comment:9 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
#7821 has the same intention, I assume.