Added exception check against missing request's annotations
authorThierry Florac <thierry.florac@onf.fr>
Tue, 27 Jun 2017 13:27:40 +0200
changeset 32 e90691696919
parent 31 65e4710b699f
child 33 383deb35fc50
Added exception check against missing request's annotations
src/pyams_i18n/negotiator.py
--- a/src/pyams_i18n/negotiator.py	Tue Jun 27 13:26:10 2017 +0200
+++ b/src/pyams_i18n/negotiator.py	Tue Jun 27 13:27:40 2017 +0200
@@ -55,6 +55,8 @@
                     try:
                         cached = request.annotations[LANGUAGE_CACHE_KEY]
                         return cached
+                    except AttributeError:
+                        return self.server_language
                     except KeyError:
                         session = request.session
                         lang = session.get('language')