Author: mtredinnick
Date: 2009-03-12 02:28:22 -0500 (Thu, 12 Mar 2009)
New Revision: 10037
Modified:
django/trunk/AUTHORS
django/trunk/django/core/urlresolvers.py
Log:
Fixed #10472 -- Fixed a race condition in reverse URL resolving.
This only shows up in for reverse() (not forwards resolving), since that
path uses a globally shared resolver object. Based on a patch from
Travis Terry.
Modified: django/trunk/AUTHORS
===================================================================
--- django/trunk/AUTHORS 2009-03-12 07:27:47 UTC (rev 10036)
+++ django/trunk/AUTHORS 2009-03-12 07:28:22 UTC (rev 10037)
@@ -402,6 +402,7 @@
Frank Tegtmeyer <[email protected]>
Marcel Telka <[email protected]>
Terry Huang <[email protected]>
+ Travis Terry <[email protected]>
thebjorn <[email protected]>
Zach Thompson <[email protected]>
Michael Thornhill
Modified: django/trunk/django/core/urlresolvers.py
===================================================================
--- django/trunk/django/core/urlresolvers.py 2009-03-12 07:27:47 UTC (rev
10036)
+++ django/trunk/django/core/urlresolvers.py 2009-03-12 07:28:22 UTC (rev
10037)
@@ -154,6 +154,7 @@
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 @@
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)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---