diff --git a/rhodecode/lib/system_info.py b/rhodecode/lib/system_info.py --- a/rhodecode/lib/system_info.py +++ b/rhodecode/lib/system_info.py @@ -182,15 +182,26 @@ def platform_type(): def locale_info(): import locale + def safe_get_locale(locale_name): + try: + locale.getlocale(locale_name) + except TypeError: + return f'FAILED_LOCALE_GET:{locale_name}' + value = dict( locale_default=locale.getdefaultlocale(), - locale_lc_all=locale.getlocale(locale.LC_ALL), + locale_lc_all=safe_get_locale(locale.LC_ALL), + locale_lc_ctype=safe_get_locale(locale.LC_CTYPE), lang_env=os.environ.get('LANG'), lc_all_env=os.environ.get('LC_ALL'), local_archive_env=os.environ.get('LOCALE_ARCHIVE'), ) - human_value = 'LANG: {}, locale LC_ALL: {}, Default locales: {}'.format( - value['lang_env'], value['locale_lc_all'], value['locale_default']) + human_value = \ + f"LANG: {value['lang_env']}, \ + locale LC_ALL: {value['locale_lc_all']}, \ + locale LC_CTYPE: {value['locale_lc_ctype']}, \ + Default locales: {value['locale_default']}" + return SysInfoRes(value=value, human_value=human_value) @@ -238,7 +249,7 @@ def uptime(): human_value['boot_time'] = time_to_datetime(boot_time) human_value['uptime'] = age(time_to_datetime(boot_time), show_suffix=False) - human_value['text'] = u'Server started {}'.format(date_or_age) + human_value['text'] = 'Server started {}'.format(date_or_age) return SysInfoRes(value=value, human_value=human_value)