Made NoReverseMatch exceptions more helpful. Thanks, mrts
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8272 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4747347385
commit
50e6928c5b
|
@ -285,10 +285,10 @@ class RegexURLResolver(object):
|
||||||
try:
|
try:
|
||||||
lookup_view = get_callable(lookup_view, True)
|
lookup_view = get_callable(lookup_view, True)
|
||||||
except (ImportError, AttributeError):
|
except (ImportError, AttributeError):
|
||||||
raise NoReverseMatch
|
raise NoReverseMatch("'%s' is not a callable." % lookup_view)
|
||||||
if lookup_view in self.reverse_dict:
|
if lookup_view in self.reverse_dict:
|
||||||
return u''.join([reverse_helper(part.regex, *args, **kwargs) for part in self.reverse_dict[lookup_view]])
|
return u''.join([reverse_helper(part.regex, *args, **kwargs) for part in self.reverse_dict[lookup_view]])
|
||||||
raise NoReverseMatch
|
raise NoReverseMatch("Reverse for '%s' not found." % lookup_view)
|
||||||
|
|
||||||
def reverse_helper(self, lookup_view, *args, **kwargs):
|
def reverse_helper(self, lookup_view, *args, **kwargs):
|
||||||
sub_match = self.reverse(lookup_view, *args, **kwargs)
|
sub_match = self.reverse(lookup_view, *args, **kwargs)
|
||||||
|
|
Loading…
Reference in New Issue