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:
parent
2f04115694
commit
af95567c14
|
@ -38,8 +38,10 @@ class RegexURLPattern:
|
||||||
mod_name, func_name = get_mod_func(self.callback)
|
mod_name, func_name = get_mod_func(self.callback)
|
||||||
try:
|
try:
|
||||||
return getattr(__import__(mod_name, '', '', ['']), func_name)
|
return getattr(__import__(mod_name, '', '', ['']), func_name)
|
||||||
except (ImportError, AttributeError), e:
|
except ImportError, e:
|
||||||
raise ViewDoesNotExist, "Tried %s. Error was: %s" % (self.callback, str(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:
|
class RegexURLMultiplePattern:
|
||||||
def __init__(self, regex, urlconf_module):
|
def __init__(self, regex, urlconf_module):
|
||||||
|
|
Loading…
Reference in New Issue