From 5c8037621c5f0161d3506f429c58c4601cd6b480 Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Wed, 17 Apr 2013 22:52:03 +0200 Subject: You know, not everybody sends Accept-Language --- tmpl.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tmpl.py b/tmpl.py index e9f3483..eae8d23 100644 --- a/tmpl.py +++ b/tmpl.py @@ -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(','): -- cgit v1.2.1