diff --git a/AUTHORS b/AUTHORS index 8da6f9b5dcb..1ad3b1ab339 100644 --- a/AUTHORS +++ b/AUTHORS @@ -402,6 +402,7 @@ answer newbie questions, and generally made Django that much better: Frank Tegtmeyer Marcel Telka Terry Huang + Travis Terry thebjorn Zach Thompson Michael Thornhill diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py index 59dcdcb4915..fba6bb22e8e 100644 --- a/django/core/urlresolvers.py +++ b/django/core/urlresolvers.py @@ -154,6 +154,7 @@ class RegexURLResolver(object): def _get_reverse_dict(self): if not self._reverse_dict: + lookups = MultiValueDict() for pattern in reversed(self.url_patterns): p_pattern = pattern.regex.pattern if p_pattern.startswith('^'): @@ -165,11 +166,12 @@ class RegexURLResolver(object): new_matches = [] for piece, p_args in parent: new_matches.extend([(piece + suffix, p_args + args) for (suffix, args) in matches]) - self._reverse_dict.appendlist(name, (new_matches, p_pattern + pat)) + lookups.appendlist(name, (new_matches, p_pattern + pat)) else: bits = normalize(p_pattern) - self._reverse_dict.appendlist(pattern.callback, (bits, p_pattern)) - self._reverse_dict.appendlist(pattern.name, (bits, p_pattern)) + lookups.appendlist(pattern.callback, (bits, p_pattern)) + lookups.appendlist(pattern.name, (bits, p_pattern)) + self._reverse_dict = lookups return self._reverse_dict reverse_dict = property(_get_reverse_dict)