diff options
author | Christian Franke <nobody@nowhere.ws> | 2013-04-17 22:52:03 +0200 |
---|---|---|
committer | Christian Franke <nobody@nowhere.ws> | 2013-04-17 22:52:03 +0200 |
commit | 5c8037621c5f0161d3506f429c58c4601cd6b480 (patch) | |
tree | 96d4742a2d65b787a85d9dab1d45cc413f62fb25 | |
parent | bdc5e1f859d366eeb63b27971b70627d7b7601dc (diff) |
You know, not everybody sends Accept-Language
-rw-r--r-- | tmpl.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -24,9 +24,11 @@ def select_language(): if cherrypy.thread_data.lang != None: lang = cherrypy.thread_data.lang return languages[lang if languages.has_key(lang) else 'en'] - accept = cherrypy.request.headers['Accept-Language'] - try: accept = str(accept) - except: accept = None + try: + accept = cherrypy.request.headers['Accept-Language'] + accept = str(accept) + except Exception: + accept = None if accept is not None: for group in accept.split(';'): for lang in group.split(','): |