Skip to content

Commit

Permalink
Fixed the url_for_static helper with root path
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentGoderre committed Mar 30, 2016
1 parent f661d20 commit a76da0c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ckan/lib/helpers.py
Expand Up @@ -118,7 +118,7 @@ def url(*args, **kw):
wrapper for pylons.url'''
locale = kw.pop('locale', None)
my_url = _pylons_default_url(*args, **kw)
return _add_i18n_to_url(my_url, locale=locale, **kw)
return _local_url(my_url, locale=locale, **kw)


def get_site_protocol_and_host():
Expand Down Expand Up @@ -176,7 +176,7 @@ def url_for(*args, **kw):
kw['protocol'], kw['host'] = get_site_protocol_and_host()
my_url = _routes_default_url_for(*args, **kw)
kw['__ckan_no_root'] = no_root
return _add_i18n_to_url(my_url, locale=locale, **kw)
return _local_url(my_url, locale=locale, **kw)


def url_for_static(*args, **kw):
Expand Down Expand Up @@ -211,8 +211,10 @@ def fix_arg(arg):

if args:
args = (fix_arg(args[0]), ) + args[1:]
if kw.get('qualified', False):
kw['protocol'], kw['host'] = get_site_protocol_and_host()
my_url = _routes_default_url_for(*args, **kw)
return my_url
return _local_url(my_url, locale='default', **kw)


def is_url(*args, **kw):
Expand All @@ -233,7 +235,7 @@ def is_url(*args, **kw):
return url.scheme in (valid_schemes or default_valid_schemes)


def _add_i18n_to_url(url_to_amend, **kw):
def _local_url(url_to_amend, **kw):
# If the locale keyword param is provided then the url is rewritten
# using that locale .If return_to is provided this is used as the url
# (as part of the language changing feature).
Expand Down

0 comments on commit a76da0c

Please sign in to comment.