From af95567c1425975353567acba8af6f14a8802276 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Mon, 1 Aug 2005 14:41:01 +0000 Subject: [PATCH] Improved error message in urlresolvers (fixes #240) git-svn-id: http://code.djangoproject.com/svn/django/trunk@357 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/urlresolvers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py index b5cdccb730..b537633646 100644 --- a/django/core/urlresolvers.py +++ b/django/core/urlresolvers.py @@ -38,8 +38,10 @@ class RegexURLPattern: mod_name, func_name = get_mod_func(self.callback) try: return getattr(__import__(mod_name, '', '', ['']), func_name) - except (ImportError, AttributeError), e: - raise ViewDoesNotExist, "Tried %s. Error was: %s" % (self.callback, str(e)) + except ImportError, e: + raise ViewDoesNotExist, "Could not import %s. Error was: %s" % (mod_name, str(e)) + except AttributeError, e: + raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" % (func_name, mod_name, str(e)) class RegexURLMultiplePattern: def __init__(self, regex, urlconf_module):