Django

Code

Changeset 5086

Show
Ignore:
Timestamp:
04/26/07 06:17:19 (2 years ago)
Author:
mtredinnick
Message:

Fixed #4129 -- Pass any prefix setting into url(...) constructions so that
prefixes work with the new syntax and strings for function names.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/conf/urls/defaults.py

    r4901 r5086  
    1212    for t in args: 
    1313        if isinstance(t, (list, tuple)): 
    14             pattern_list.append(url(prefix=prefix, *t)) 
    15         else: 
    16             pattern_list.append(t) 
     14            t = url(prefix=prefix, *t) 
     15        elif isinstance(t, RegexURLPattern): 
     16            t.add_prefix(prefix) 
     17        pattern_list.append(t) 
    1718    return pattern_list 
    1819 
  • django/trunk/django/core/urlresolvers.py

    r4901 r5086  
    103103        self.name = name 
    104104 
     105    def add_prefix(self, prefix): 
     106        """ 
     107        Adds the prefix string to a string-based callback. 
     108        """ 
     109        if not prefix or not hasattr(self, '_callback_str'): 
     110            return 
     111        self._callback_str = prefix + '.' + self._callback_str 
     112 
    105113    def resolve(self, path): 
    106114        match = self.regex.search(path)