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:
Luke Plant 2008-08-09 18:06:51 +00:00
parent 4747347385
commit 50e6928c5b
1 changed files with 2 additions and 2 deletions

View File

@ -285,10 +285,10 @@ class RegexURLResolver(object):
try:
lookup_view = get_callable(lookup_view, True)
except (ImportError, AttributeError):
raise NoReverseMatch
raise NoReverseMatch("'%s' is not a callable." % lookup_view)
if lookup_view in self.reverse_dict:
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):
sub_match = self.reverse(lookup_view, *args, **kwargs)