FIX:(#1929) Will default to en_US.UTF-8 locale if locale returns nothing

This commit is contained in:
evilhero 2018-04-25 13:00:18 -04:00
parent 0efc698086
commit 559e57a5c1
1 changed files with 8 additions and 3 deletions

View File

@ -31,9 +31,14 @@ try:
localeinfo = locale.getdefaultlocale()
language = localeinfo[0]
charset = localeinfo[1]
except:
language = 'en'
charset = 'UTF-8'
if any([language is None, charset is None]):
raise AttributeError
except AttributeError:
#if it's set to None (ie. dockerized) - default to en_US.UTF-8.
if language is None:
language = 'en_US'
if charset is None:
charset = 'UTF-8'
LOG_LANG = language
LOG_CHARSET = charset