Changeset 5630
- Timestamp:
- 07/07/07 13:24:27 (1 year ago)
- Files:
-
- django/trunk/django/core/urlresolvers.py (modified) (5 diffs)
- django/trunk/django/template/__init__.py (modified) (2 diffs)
- django/trunk/tests/regressiontests/templates/tests.py (modified) (1 diff)
- django/trunk/tests/regressiontests/templates/urls.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/urlresolvers.py
r5609 r5630 10 10 from django.http import Http404 11 11 from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist 12 from django.utils.encoding import iri_to_uri 12 from django.utils.encoding import iri_to_uri, force_unicode 13 13 from django.utils.functional import memoize 14 14 import re … … 102 102 # 103 103 grouped = match_obj.group(1) 104 m = re.search(r'^\?P<(\w+)>(.*?)$', grouped )104 m = re.search(r'^\?P<(\w+)>(.*?)$', grouped, re.UNICODE) 105 105 if m: # If this was a named group... 106 106 # m.group(1) is the name of the group … … 128 128 # Note we're using re.match here on purpose because the start of 129 129 # to string needs to match. 130 if not re.match(test_regex + '$', str(value)): # TODO: Unicode?130 if not re.match(test_regex + '$', force_unicode(value), re.UNICODE): 131 131 raise NoReverseMatch("Value %r didn't match regular expression %r" % (value, test_regex)) 132 return str(value) # TODO: Unicode?132 return force_unicode(value) 133 133 134 134 class RegexURLPattern(object): … … 138 138 # which represents the path to a module and a view function name, or a 139 139 # callable object (view). 140 self.regex = re.compile(regex )140 self.regex = re.compile(regex, re.UNICODE) 141 141 if callable(callback): 142 142 self._callback = callback … … 202 202 # regex is a string representing a regular expression. 203 203 # urlconf_name is a string representing the module containing urlconfs. 204 self.regex = re.compile(regex )204 self.regex = re.compile(regex, re.UNICODE) 205 205 self.urlconf_name = urlconf_name 206 206 self.callback = None django/trunk/django/template/__init__.py
r5609 r5630 513 513 )""" % { 514 514 'str': r"""[^"\\]*(?:\\.[^"\\]*)*""", 515 'var_chars': " A-Za-z0-9\_\." ,515 'var_chars': "\w\." , 516 516 'filter_sep': re.escape(FILTER_SEPARATOR), 517 517 'arg_sep': re.escape(FILTER_ARGUMENT_SEPARATOR), … … 521 521 522 522 filter_raw_string = filter_raw_string.replace("\n", "").replace(" ", "") 523 filter_re = re.compile(filter_raw_string )523 filter_re = re.compile(filter_raw_string, re.UNICODE) 524 524 525 525 class FilterExpression(object): django/trunk/tests/regressiontests/templates/tests.py
r5609 r5630 736 736 'url03' : ('{% url regressiontests.templates.views.index %}', {}, '/url_tag/'), 737 737 'url04' : ('{% url named.client client.id %}', {'client': {'id': 1}}, '/url_tag/named-client/1/'), 738 'url05' : (u'{% url ЌеÑка_ПпеÑаÑПÑа 1 %}', {}, '/url_tag/unicode/1/'), 738 'url05' : (u'{% url ЌеÑка_ПпеÑаÑПÑа v %}', {'v': u'Ω'}, 739 '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'), 739 740 740 741 # Failures django/trunk/tests/regressiontests/templates/urls.py
r5609 r5630 10 10 (r'^client/(\d+)/(?P<action>[^/]+)/$', views.client_action), 11 11 url(r'^named-client/(\d+)/$', views.client, name="named.client"), 12 url(r'^unicode/(\d+)/$', views.client, name=u"ЌеÑка_ПпеÑаÑПÑа"), 12 13 # Unicode strings are permitted everywhere. 14 url(ur'^ЮМОкПЎ/(\w+)/$', views.client, name=u"ЌеÑка_ПпеÑаÑПÑа"), 13 15 )
