Only use full-name substitutions, to allow % in URLs
This commit is contained in:
parent
28d16c01eb
commit
6e9910ae9a
1 changed files with 8 additions and 3 deletions
|
|
@ -143,9 +143,14 @@ class URL(object):
|
||||||
patterns += normalize(url)
|
patterns += normalize(url)
|
||||||
|
|
||||||
for pattern, _ in patterns:
|
for pattern, _ in patterns:
|
||||||
try:
|
url = pattern
|
||||||
url = pattern % kwargs
|
# only use full-name substitutions, to allow % in URLs
|
||||||
except KeyError:
|
for kwkey in kwargs:
|
||||||
|
search = '%%(%s)s' % kwkey
|
||||||
|
if search in pattern:
|
||||||
|
url = url.replace(search, unicode(kwargs[kwkey]))
|
||||||
|
# if there are named substitutions left, ignore pattern
|
||||||
|
if re.search('%\([A-z_]+\)s', url):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return self.browser.absurl(url, base=True)
|
return self.browser.absurl(url, base=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue