summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Franke <nobody@nowhere.ws>2013-04-17 22:52:03 +0200
committerChristian Franke <nobody@nowhere.ws>2013-04-17 22:52:03 +0200
commit5c8037621c5f0161d3506f429c58c4601cd6b480 (patch)
tree96d4742a2d65b787a85d9dab1d45cc413f62fb25
parentbdc5e1f859d366eeb63b27971b70627d7b7601dc (diff)
You know, not everybody sends Accept-Language
-rw-r--r--tmpl.py8
1 files 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(','):