Ticket #4772: urlresolvers_unicode.patch
File urlresolvers_unicode.patch, 1.1 KB (added by , 17 years ago) |
---|
-
django/core/urlresolvers.py
10 10 from django.http import Http404 11 11 from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist 12 12 from django.utils.encoding import iri_to_uri 13 from django.utils.encoding import force_unicode 13 14 from django.utils.functional import memoize 14 15 import re 15 16 … … 127 128 test_regex = grouped 128 129 # Note we're using re.match here on purpose because the start of 129 130 # to string needs to match. 130 if not re.match(test_regex + '$', str(value)): # TODO: Unicode?131 if not re.match(test_regex + '$', force_unicode(value)): 131 132 raise NoReverseMatch("Value %r didn't match regular expression %r" % (value, test_regex)) 132 return str(value) # TODO: Unicode?133 return force_unicode(value) 133 134 134 135 class RegexURLPattern(object): 135 136 def __init__(self, regex, callback, default_args=None, name=None):