Ticket #10472: thread-safe-urlresolvers.diff

File thread-safe-urlresolvers.diff, 1.7 KB (added by tdterry, 16 years ago)

Patch against r10030 to solve threadsafe issues with the urlresolvers.RegexURLResolver

  • django/core/urlresolvers.py

     
    154154
    155155    def _get_reverse_dict(self):
    156156        if not self._reverse_dict:
     157            _reverse_dict = {}
    157158            for pattern in reversed(self.url_patterns):
    158159                p_pattern = pattern.regex.pattern
    159160                if p_pattern.startswith('^'):
     
    165166                            new_matches = []
    166167                            for piece, p_args in parent:
    167168                                new_matches.extend([(piece + suffix, p_args + args) for (suffix, args) in matches])
    168                             self._reverse_dict.appendlist(name, (new_matches, p_pattern + pat))
     169                            _reverse_dict.appendlist(name, (new_matches, p_pattern + pat))
    169170                else:
    170171                    bits = normalize(p_pattern)
    171                     self._reverse_dict.appendlist(pattern.callback, (bits, p_pattern))
    172                     self._reverse_dict.appendlist(pattern.name, (bits, p_pattern))
     172                    _reverse_dict.appendlist(pattern.callback, (bits, p_pattern))
     173                    _reverse_dict.appendlist(pattern.name, (bits, p_pattern))
     174            self._reverse_dict = _reverse_dict
    173175        return self._reverse_dict
    174176    reverse_dict = property(_get_reverse_dict)
    175177
  • AUTHORS

     
    449449    Mykola Zamkovoi <nickzam@gmail.com>
    450450    Jarek Zgoda <jarek.zgoda@gmail.com>
    451451    Cheng Zhang
     452    Travis Terry <tdterry7@gmail.com>
    452453
    453454A big THANK YOU goes to:
    454455
Back to Top