Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
Zharktas authored and tino097 committed Sep 26, 2017
1 parent e5963c3 commit 1ccdc57
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ckan/lib/helpers.py
Expand Up @@ -157,14 +157,16 @@ def redirect_to(*args, **kw):
# Routes router doesn't like unicode args
uargs = map(lambda arg: str(arg) if isinstance(arg, unicode) else arg,
args)

# Remove LANG from root_path so that we do not need to parse locales
root_path = config.get('ckan.root_path', None)
if root_path:
root_path = re.sub('/{{LANG}}', '', root_path)

# If args contain full url eg. http://example.com or url starting with root_path skip url parsing
if uargs and (is_url(uargs[0]) or ( root_path and uargs[0].startswith(root_path))) :
# If args contain full url eg. http://example.com
# or url starting with root_path skip url parsing
if uargs and (is_url(uargs[0])
or (root_path and uargs[0].startswith(root_path))):
return _routes_redirect_to(uargs[0])

_url = url_for(*uargs, **kw)
Expand Down

0 comments on commit 1ccdc57

Please sign in to comment.