diff --git a/ckan/controllers/user.py b/ckan/controllers/user.py index 045a9d86cfb..de186deb245 100644 --- a/ckan/controllers/user.py +++ b/ckan/controllers/user.py @@ -397,8 +397,7 @@ def login(self, error=None): if not c.user: came_from = request.params.get('came_from') if not came_from: - came_from = h.url_for(controller='user', action='logged_in', - __ckan_no_root=True) + came_from = h.url_for(controller='user', action='logged_in') c.login_handler = h.url_for( self._get_repoze_handler('login_handler_path'), came_from=came_from) @@ -436,10 +435,9 @@ def logout(self): # Do any plugin logout stuff for item in p.PluginImplementations(p.IAuthenticator): item.logout() - url = h.url_for(controller='user', action='logged_out_page', - __ckan_no_root=True) + url = h.url_for(controller='user', action='logged_out_page') h.redirect_to(self._get_repoze_handler('logout_handler_path') + - '?came_from=' + url) + '?came_from=' + url, parse_url=True) def logged_out(self): # redirect if needed diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py index dc87b5fd50e..8baa21b17a6 100644 --- a/ckan/lib/helpers.py +++ b/ckan/lib/helpers.py @@ -166,17 +166,12 @@ def redirect_to(*args, **kw): uargs = map(lambda arg: str(arg) if isinstance(arg, unicode) else arg, args) - # Repoze.who redirects with single strings - # which need to be parsed by url_for - exempt_urls = ['/user/logout', '/user/logged_out_redirect', - '/user/logged_in'] - matching = [s for s in uargs if any(xs in s for xs in exempt_urls)] - _url = '' skip_url_parsing = False + parse_url = kw.pop('parse_url', False) if uargs and len(uargs) is 1 and isinstance(uargs[0], basestring) \ and (uargs[0].startswith('/') or is_url(uargs[0])) \ - and len(matching) is 0: + and parse_url is False: skip_url_parsing = True _url = uargs[0]