Fixed #4129 -- Pass any prefix setting into url(...) constructions so that
prefixes work with the new syntax and strings for function names. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5086 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
21d9387cea
commit
f85f1d077a
|
@ -11,8 +11,9 @@ def patterns(prefix, *args):
|
|||
pattern_list = []
|
||||
for t in args:
|
||||
if isinstance(t, (list, tuple)):
|
||||
pattern_list.append(url(prefix=prefix, *t))
|
||||
else:
|
||||
t = url(prefix=prefix, *t)
|
||||
elif isinstance(t, RegexURLPattern):
|
||||
t.add_prefix(prefix)
|
||||
pattern_list.append(t)
|
||||
return pattern_list
|
||||
|
||||
|
|
|
@ -102,6 +102,14 @@ class RegexURLPattern(object):
|
|||
self.default_args = default_args or {}
|
||||
self.name = name
|
||||
|
||||
def add_prefix(self, prefix):
|
||||
"""
|
||||
Adds the prefix string to a string-based callback.
|
||||
"""
|
||||
if not prefix or not hasattr(self, '_callback_str'):
|
||||
return
|
||||
self._callback_str = prefix + '.' + self._callback_str
|
||||
|
||||
def resolve(self, path):
|
||||
match = self.regex.search(path)
|
||||
if match:
|
||||
|
|
Loading…
Reference in New Issue