Skip to content

Commit

Permalink
Fix broken root_path implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Oderbolz authored and wardi committed May 25, 2016
1 parent 8d2e7ce commit 3ba76e1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions ckan/lib/helpers.py
Expand Up @@ -231,15 +231,16 @@ def _add_i18n_to_url(url_to_amend, **kw):
# into the ecportal core is done - Toby
# we have a special root specified so use that
if default_locale:
root = re.sub('/{{LANG}}', '', root_path)
root_path = re.sub('/{{LANG}}', '', root_path)
else:
root = re.sub('{{LANG}}', locale, root_path)
root_path = re.sub('{{LANG}}', locale, root_path)
# make sure we don't have a trailing / on the root
if root[-1] == '/':
root = root[:-1]
url = url_to_amend[len(re.sub('/{{LANG}}', '', root_path)):]
url = '%s%s' % (root, url)
root = re.sub('/{{LANG}}', '', root_path)
if root_path[-1] == '/':
root_path = root_path[:-1]
# TODO: this seems broken

url_path = url_to_amend[len(root):]
url = '%s%s%s' % (root, root_path, url_path)
else:
if default_locale:
url = url_to_amend
Expand Down

0 comments on commit 3ba76e1

Please sign in to comment.