fix language check when no Accept-Language header is set

This commit is contained in:
Jan Dittberner 2015-02-20 23:01:34 +01:00
parent b566a2588e
commit afe5828b16
2 changed files with 10 additions and 5 deletions

View file

@ -1,5 +1,6 @@
2015-02-20 Jan Dittberner <jan@dittberner.info> 2015-02-20 Jan Dittberner <jan@dittberner.info>
* add Jessie requirements file * add Jessie requirements file
* fix language check if no Accept-Language header is sent
2014-10-14 Jan Dittberner <jan@dittberner.info> 2014-10-14 Jan Dittberner <jan@dittberner.info>
* add patch by Paul Wise to use to update DUCK link to new static page * add patch by Paul Wise to use to update DUCK link to new static page

View file

@ -39,11 +39,15 @@ class BaseController(WSGIController):
# the request is routed to. This routing information is # the request is routed to. This routing information is
# available in environ['pylons.routes_dict'] # available in environ['pylons.routes_dict']
# set language environment # set language environment
for lang in request.languages: try:
languages = request.languages
for lang in languages:
try: try:
add_fallback(lang.replace('-', '_')) add_fallback(lang.replace('-', '_'))
except: except:
pass pass
except:
pass
c.messages = {'errors': [], 'messages': []} c.messages = {'errors': [], 'messages': []}
return WSGIController.__call__(self, environ, start_response) return WSGIController.__call__(self, environ, start_response)