Ticket #14761: ticket-14761.diff

File ticket-14761.diff, 1.4 KB (added by samuel337, 14 years ago)
  • django/core/urlresolvers.py

    diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py
    index 5e565f7..a1bd406 100644
    a b class RegexURLPattern(object):  
    156156
    157157            return ResolverMatch(self.callback, args, kwargs, self.name)
    158158
     159    def _get_possibilities(self):
     160        """
     161        Returns a list of possible regexp matches for this pattern.
     162       
     163        This method is intended as a stopgap until the URL resolution system is
     164        completely revamped. Hence it is marked private, even though it will be
     165        used outside this class.
     166        """
     167        return normalize(self.regex.pattern)
     168
    159169    def _get_callback(self):
    160170        if self._callback is not None:
    161171            return self._callback
    class RegexURLResolver(object):  
    215225                    for app_name, namespace_list in pattern.app_dict.items():
    216226                        apps.setdefault(app_name, []).extend(namespace_list)
    217227            else:
    218                 bits = normalize(p_pattern)
     228                if hasattr(pattern, '_get_possibilities'):
     229                    bits = pattern._get_possibilities()
     230                else:
     231                    bits = normalize(p_pattern)
    219232                lookups.appendlist(pattern.callback, (bits, p_pattern))
    220233                if pattern.name is not None:
    221234                    lookups.appendlist(pattern.name, (bits, p_pattern))
Back to Top