Improved ViewDoesNotExist error messages in django.core.urlresolvers

git-svn-id: http://code.djangoproject.com/svn/django/trunk@193 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-07-19 04:30:23 +00:00
parent 73ea27ccb0
commit 3ab5791383
1 changed files with 4 additions and 4 deletions

View File

@ -38,8 +38,8 @@ class RegexURLPattern:
mod_name, func_name = get_mod_func(self.callback)
try:
return getattr(__import__(mod_name, '', '', ['']), func_name)
except (ImportError, AttributeError):
raise ViewDoesNotExist, self.callback
except (ImportError, AttributeError), e:
raise ViewDoesNotExist, "Tried %s. Error was: %s" % (self.callback, str(e))
class RegexURLMultiplePattern:
def __init__(self, regex, urlconf_module):
@ -92,5 +92,5 @@ class Error404Resolver:
mod_name, func_name = get_mod_func(self.callback)
try:
return getattr(__import__(mod_name, '', '', ['']), func_name), {}
except (ImportError, AttributeError):
raise ViewDoesNotExist, self.callback
except (ImportError, AttributeError), e:
raise ViewDoesNotExist, "Tried %s. Error was: %s" % (self.callback, str(e))