From 5a32b3ac2c99a1f3e033dd3af1b20e309ccea8ad Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sun, 8 Jul 2007 11:22:53 +0000 Subject: [PATCH] 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 --- django/core/urlresolvers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py index 34b40db6c6..7e4f4c8431 100644 --- a/django/core/urlresolvers.py +++ b/django/core/urlresolvers.py @@ -9,7 +9,7 @@ a string) and returns a tuple in this format: from django.http import Http404 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 import re @@ -229,8 +229,10 @@ class RegexURLResolver(object): tried.extend([(pattern.regex.pattern + ' ' + t) for t in e.args[0]['tried']]) else: if sub_match: - sub_match_dict = dict(self.default_kwargs, **sub_match[2]) - return sub_match[0], sub_match[1], dict(match.groupdict(), **sub_match_dict) + sub_match_dict = dict([(smart_str(k), v) for k, v in match.groupdict().items()]) + 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) raise Resolver404, {'tried': tried, 'path': new_path}