don't absolutify if the url already looks absolute (bug 684128)
This commit is contained in:
Родитель
e08755527c
Коммит
a8666d95c3
|
@ -295,7 +295,10 @@ def json(s):
|
|||
@register.filter
|
||||
def absolutify(url):
|
||||
"""Takes a URL and prepends the SITE_URL"""
|
||||
return settings.SITE_URL + url
|
||||
if url.startswith('http'):
|
||||
return url
|
||||
else:
|
||||
return settings.SITE_URL + url
|
||||
|
||||
|
||||
@register.filter
|
||||
|
|
|
@ -433,3 +433,9 @@ def test_jinja_trans_monkeypatch():
|
|||
render('{% trans come_on=1 %}% (come_on)s{% endtrans %}')
|
||||
render('{% trans come_on=1 %}%(come_on){% endtrans %}')
|
||||
render('{% trans come_on=1 %}%(come_on)z{% endtrans %}')
|
||||
|
||||
|
||||
def test_absolutify():
|
||||
eq_(helpers.absolutify('/woo'), settings.SITE_URL + '/woo')
|
||||
eq_(helpers.absolutify('https://addons.mozilla.org'),
|
||||
'https://addons.mozilla.org')
|
||||
|
|
Загрузка…
Ссылка в новой задаче