Opened 18 years ago
Closed 15 years ago
#3221 closed enhancement (fixed)
[patch] unhelpful error message when include() set incorrectly
Reported by: | Owned by: | oggie_rob | |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | minor | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | UI/UX: |
Description
instead of 'module' has no attribute 'urlpatterns', a more useful error message would be nice to have, as I just wasted 30 mins of time just to notice I forgot to append .urls in an include() in urlconf.
I've patched my django.core.urlresolvers with this:
Index: urlresolvers.py =================================================================== --- urlresolvers.py (wersja 4270) +++ urlresolvers.py (kopia robocza) @@ -157,6 +157,8 @@ match = self.regex.search(path) if match: new_path = path[match.end():] + if not hasattr(self.urlconf_module, 'urlpatterns'): + raise AttributeError('urlpatterns in module %s not found, is the parent urlconf correct?'%self.urlconf_module.__name__) for pattern in self.urlconf_module.urlpatterns: try: sub_match = pattern.resolve(new_path)
Attachments (1)
Change History (5)
comment:1 by , 18 years ago
Has patch: | set |
---|---|
Summary: | unhelpful error message when include() set incorrectly → [patch] unhelpful error message when include() set incorrectly |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
Owner: | changed from | to
---|
by , 17 years ago
Attachment: | 3221_import_error.diff added |
---|
comment:4 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
A slightly different more useful error message has found its way into the trunk already.
Note:
See TracTickets
for help on using tickets.
Catch ImpotError & raise ValidationError to clarify location/problem with import