Ticket #6170: core_urlresovlers__better_error_message.diff
File core_urlresovlers__better_error_message.diff, 970 bytes (added by , 17 years ago) |
---|
-
django/core/urlresolvers.py
125 125 test_regex = grouped 126 126 # Note we're using re.match here on purpose because the start of 127 127 # to string needs to match. 128 if not re.match(test_regex + '$', force_unicode(value), re.UNICODE): 129 raise NoReverseMatch("Value %r didn't match regular expression %r" % (value, test_regex)) 128 try: 129 if not re.match(test_regex + '$', force_unicode(value), re.UNICODE): 130 raise NoReverseMatch("Value %r didn't match regular expression %r" % (value, test_regex)) 131 except re.error: 132 raise NoReverseMatch("Failed to reverse regular expression. Does it contain nested parenthesis?") 133 130 134 return force_unicode(value) 131 135 132 136 class RegexURLPattern(object):