Browse Source

Adds exception management in language code access

Adrien Panay 7 years ago
parent
commit
7dfbab95ef
2 changed files with 10 additions and 1 deletions
  1. 1 0
      tracim/test.ini
  2. 9 1
      tracim/tracim/lib/helpers.py

+ 1 - 0
tracim/test.ini View File

26
 # sqlalchemy.url = mysql+pymysql://tracimuser:tracimpassword@127.0.0.1/tracimdb_test
26
 # sqlalchemy.url = mysql+pymysql://tracimuser:tracimpassword@127.0.0.1/tracimdb_test
27
 sqlalchemy.url = sqlite:///tracimdb_test.sqlite
27
 sqlalchemy.url = sqlite:///tracimdb_test.sqlite
28
 use = config:development.ini
28
 use = config:development.ini
29
+lang = fr
29
 
30
 
30
 [app:main_without_authn]
31
 [app:main_without_authn]
31
 use = main
32
 use = main

+ 9 - 1
tracim/tracim/lib/helpers.py View File

36
     - asked by the request to the server,
36
     - asked by the request to the server,
37
     - supported by Tracim.
37
     - supported by Tracim.
38
     """
38
     """
39
-    return tg.i18n.get_lang(all=False)[0]
39
+    # TODO - A.P - language code access from test environment
40
+    # try based workaround instead of raw get language call for test
41
+    # environment only, this should be set with tg.i18n.set_lang in
42
+    # be I was unable to achieve that.
43
+    try:
44
+        result = tg.i18n.get_lang(all=False)[0]
45
+    except:
46
+        result = 'en'
47
+    return result
40
 
48
 
41
 
49
 
42
 def get_with_timezone(
50
 def get_with_timezone(