From afe5828b166e272d1923017fd8c46e435bb285ec Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Fri, 20 Feb 2015 23:01:34 +0100 Subject: [PATCH] fix language check when no Accept-Language header is set --- ChangeLog | 1 + debianmemberportfolio/lib/base.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc8b392..77dfb1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2015-02-20 Jan Dittberner * add Jessie requirements file + * fix language check if no Accept-Language header is sent 2014-10-14 Jan Dittberner * add patch by Paul Wise to use to update DUCK link to new static page diff --git a/debianmemberportfolio/lib/base.py b/debianmemberportfolio/lib/base.py index da057f4..7746e92 100644 --- a/debianmemberportfolio/lib/base.py +++ b/debianmemberportfolio/lib/base.py @@ -39,11 +39,15 @@ class BaseController(WSGIController): # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] # set language environment - for lang in request.languages: - try: - add_fallback(lang.replace('-', '_')) - except: - pass + try: + languages = request.languages + for lang in languages: + try: + add_fallback(lang.replace('-', '_')) + except: + pass + except: + pass c.messages = {'errors': [], 'messages': []} return WSGIController.__call__(self, environ, start_response)