Skip to content

Commit

Permalink
remove the old /locale controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Toby committed Feb 9, 2012
1 parent a57f8a7 commit 516c335
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
1 change: 0 additions & 1 deletion ckan/config/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def make_map():
map = plugin.before_map(map)

map.connect('home', '/', controller='home', action='index')
map.connect('/locale', controller='home', action='locale')
map.connect('about', '/about', controller='home', action='about')

# CKAN API versioned.
Expand Down
28 changes: 0 additions & 28 deletions ckan/controllers/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,34 +88,6 @@ def license(self):

def about(self):
return render('home/about.html')

def locale(self):
locale = request.params.get('locale')
if locale is not None:
try:
set_session_locale(locale)
except ValueError:
abort(400, _('Invalid language specified'))
try:
set_lang(locale)
# NOTE: When translating this string, substitute the word
# 'English' for the language being translated into.
# We do it this way because some Babel locales don't contain
# a display_name!
# e.g. babel.Locale.parse('no').get_display_name() returns None
h.flash_notice(_("Language has been set to: English"))
except:
h.flash_notice(_("Language has been set to: English"))
else:
abort(400, _("No language given!"))
return_to = get_redirect()
if not return_to:
# no need for error, just don't redirect
return
return_to += '&' if '?' in return_to else '?'
# hack to prevent next page being cached
return_to += '__cache=%s' % int(random.random()*100000000)
redirect_to(return_to)

def cache(self, id):
'''Manual way to clear the caches'''
Expand Down

0 comments on commit 516c335

Please sign in to comment.