Fixed #4798-- Made sure that function keyword arguments are strings (for the

keywords themselves) when using Unicode URL patterns.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@5636 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-07-08 11:22:53 +00:00
parent b6812f2d9d
commit 5a32b3ac2c
1 changed files with 5 additions and 3 deletions

View File

@ -9,7 +9,7 @@ a string) and returns a tuple in this format:
from django.http import Http404 from django.http import Http404
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
from django.utils.encoding import iri_to_uri, force_unicode from django.utils.encoding import iri_to_uri, force_unicode, smart_str
from django.utils.functional import memoize from django.utils.functional import memoize
import re import re
@ -229,8 +229,10 @@ class RegexURLResolver(object):
tried.extend([(pattern.regex.pattern + ' ' + t) for t in e.args[0]['tried']]) tried.extend([(pattern.regex.pattern + ' ' + t) for t in e.args[0]['tried']])
else: else:
if sub_match: if sub_match:
sub_match_dict = dict(self.default_kwargs, **sub_match[2]) sub_match_dict = dict([(smart_str(k), v) for k, v in match.groupdict().items()])
return sub_match[0], sub_match[1], dict(match.groupdict(), **sub_match_dict) sub_match_dict.update(self.default_kwargs)
sub_match_dict.update([(smart_str(k), v) for k, v in sub_match[2].items()])
return sub_match[0], sub_match[1], sub_match_dict
tried.append(pattern.regex.pattern) tried.append(pattern.regex.pattern)
raise Resolver404, {'tried': tried, 'path': new_path} raise Resolver404, {'tried': tried, 'path': new_path}