Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/webactivity.py
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2009-02-20 16:55:13 (GMT)
committer Simon Schampijer <simon@schampijer.de>2009-02-20 16:55:13 (GMT)
commit006f3908ee4bcd1f1b3cde78b89213adabd0056e (patch)
treeefd48550a653a4f64c222290838741de3f34f503 /webactivity.py
parenta75dd61b7b50f33faaa26461b3f2d11ea0eaf2a6 (diff)
Better language recognition
Diffstat (limited to 'webactivity.py')
-rw-r--r--webactivity.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/webactivity.py b/webactivity.py
index cc2a424..4617a18 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -551,15 +551,12 @@ class WebActivity(activity.Activity):
def _set_accept_languages(self):
try:
- lang = os.environ['LANG'] # e.g. es_UY.UTF-8
- except:
- return
-
- if len(lang) != 11:
- _logger.debug("Set_Accept_language: bad LANG length")
- return
+ lang = os.environ['LANG'].strip('\n') # e.g. es_UY.UTF-8
+ except KeyError:
+ return
- if not lang.endswith(".UTF-8") or lang[2] != "_":
+ if (not lang.endswith(".utf8") or not lang.endswith(".UTF-8")) \
+ and lang[2] != "_":
_logger.debug("Set_Accept_language: unrecognised LANG format")
return