From 6a989e655a342fba6573ef6797a251b24972ea96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Mon, 26 May 2014 12:19:25 +0200 Subject: [PATCH] [fix] Always set locale to use for a request in the api --- moulinette/interfaces/api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/moulinette/interfaces/api.py b/moulinette/interfaces/api.py index b2b8d644..cd131258 100644 --- a/moulinette/interfaces/api.py +++ b/moulinette/interfaces/api.py @@ -554,9 +554,10 @@ class Interface(BaseInterface): ## Attempt to retrieve and set locale def api18n(callback): try: - m18n.set_locale(request.params.pop('locale')) - except: - pass + locale = request.params.pop('locale') + except KeyError: + locale = m18n.default_locale + m18n.set_locale(locale) return callback # Install plugins