Improved error message in urlresolvers (fixes #240)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@357 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2005-08-01 14:41:01 +00:00
parent 2f04115694
commit af95567c14
1 changed files with 4 additions and 2 deletions

View File

@ -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):