Skip to content

Commit

Permalink
Merge branch 'master' of github.com:okfn/ckan
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hammond committed Apr 10, 2012
2 parents 521ad86 + bc6183c commit 7ac1b5d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions ckan/config/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def make_map():
m.connect('/user/reset/{id:.*}', action='perform_reset')
m.connect('/user/register', action='register')
m.connect('/user/login', action='login')
m.connect('/user/_logout', action='logout')
m.connect('/user/logged_in', action='logged_in')
m.connect('/user/logged_out', action='logged_out')
m.connect('/user/logged_out_redirect', action='logged_out_page')
Expand Down
2 changes: 1 addition & 1 deletion ckan/controllers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def logout(self):
# save our language in the session so we don't loose it
session['lang'] = request.environ.get('CKAN_LANG')
session.save()
h.redirect_to('/user/logout_generic')
h.redirect_to('/user/logout')

def set_lang(self, lang):
# this allows us to set the lang in session. Used for logging
Expand Down
6 changes: 5 additions & 1 deletion ckan/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def _add_i18n_to_url(url_to_amend, **kw):
# position in the url
root_path = config.get('ckan.root_path')
if root_path:
# FIXME this can be written better once the merge
# 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)
Expand All @@ -121,7 +123,9 @@ def _add_i18n_to_url(url_to_amend, **kw):
# make sure we don't have a trailing / on the root
if root[-1] == '/':
root = root[:-1]
url = '%s%s' % (root, url_to_amend)
url = url_to_amend[len(re.sub('/{{LANG}}', '', root_path)):]
url = '%s%s' % (root, url)
root = re.sub('/{{LANG}}', '', root_path)
else:
if default_locale:
url = url_to_amend
Expand Down
4 changes: 2 additions & 2 deletions ckan/public/scripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ CKAN.Utils = CKAN.Utils || {};
if (window.openid && openid.signin){
openid._signin = openid.signin;
openid.signin = function (arg) {
$.get('/user/set_lang/' + CKAN.LANG, function (){openid._signin(arg);})
$.get(CKAN.SITE_URL + '/user/set_lang/' + CKAN.LANG, function (){openid._signin(arg);})
};
}
if ($('#login').length){
$('#login').submit( function () {
$.ajax('/user/set_lang/' + CKAN.LANG, {async:false});
$.ajax('CKAN.SITE_URL + /user/set_lang/' + CKAN.LANG, {async:false});
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/layout_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<div class="menu account">
<span class="ckan-logged-in" style="display: none;">
<a href="${h.url_for(controller='user',action='me')}">${h.gravatar((c.userobj.email_hash if c and c.userobj else ''),size=20)}${c.user}</a>
<a href="${h.url_for('/user/logout')}">Logout</a>
<a href="${h.url_for('/user/_logout')}">Logout</a>
</span>
<span class="ckan-logged-out">
<a href="${h.url_for(controller='user',action='login')}">Login</a>
Expand Down

0 comments on commit 7ac1b5d

Please sign in to comment.