Make remora_url preserve trailing slashes (bug 565401)
This commit is contained in:
Родитель
12cd77e312
Коммит
7761e5387a
|
@ -162,3 +162,7 @@ class TestHelpers(TestCase):
|
|||
# UTF-8 strings
|
||||
url = remora_url(ctx, u'/tags/Hallo und tschüß')
|
||||
eq_(url, '/en-US/firefox/tags/Hallo%20und%20tsch%C3%BC%C3%9F')
|
||||
|
||||
# Trailing slashes are kept if present.
|
||||
eq_(remora_url(ctx, '/foo'), '/en-US/firefox/foo')
|
||||
eq_(remora_url(ctx, '/foo/'), '/en-US/firefox/foo/')
|
||||
|
|
|
@ -15,6 +15,7 @@ def remora_url(url, lang=None, app=None, prefix=''):
|
|||
if app is None:
|
||||
app = getattr(prefixer, 'app', settings.DEFAULT_APP)
|
||||
|
||||
url_parts = [p.strip('/') for p in (prefix, lang, app, url) if p]
|
||||
url_parts = [p for p in (
|
||||
prefix.strip('/'), lang, app, url.lstrip('/')) if p]
|
||||
|
||||
return url_fix('/'+'/'.join(url_parts))
|
||||
|
|
Загрузка…
Ссылка в новой задаче