##// END OF EJS Templates
kallithea-cli: set ssh_locale when creating .ini file so it doesn't have to be set manually before using ssh...
Thomas De Schampheleire -
r7693:0f33c1da default
parent child Browse files
Show More
@@ -22,6 +22,7 b' from collections import defaultdict'
22
22
23 import mako.exceptions
23 import mako.exceptions
24
24
25 import kallithea.lib.locale
25 from kallithea.lib import inifile
26 from kallithea.lib import inifile
26
27
27 def show_defaults(ctx, param, value):
28 def show_defaults(ctx, param, value):
@@ -64,6 +65,7 b' def config_create(config_file, key_value'
64 'git_hook_interpreter': sys.executable,
65 'git_hook_interpreter': sys.executable,
65 'user_home_path': os.path.expanduser('~'),
66 'user_home_path': os.path.expanduser('~'),
66 'kallithea_cli_path': cli_base.kallithea_cli_path,
67 'kallithea_cli_path': cli_base.kallithea_cli_path,
68 'ssh_locale': kallithea.lib.locale.get_current_locale(),
67 }
69 }
68 ini_settings = defaultdict(dict)
70 ini_settings = defaultdict(dict)
69
71
@@ -35,3 +35,14 b' def current_locale_is_valid():'
35 log.error("Note: No locale setting found in environment variables - perhaps set LC_CTYPE to some value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'")
35 log.error("Note: No locale setting found in environment variables - perhaps set LC_CTYPE to some value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'")
36 return False
36 return False
37 return True
37 return True
38
39 def get_current_locale():
40 """Return the current locale based on environment variables.
41 There does not seem to be a good (and functional) way to get it via Python.
42 """
43 for var in ['LC_ALL', 'LC_CTYPE', 'LANG']:
44 val = os.environ.get(var)
45 if val:
46 log.debug('Determined current locale via environment variable %s (%s)', var, val)
47 return val
48 return None
@@ -346,6 +346,9 b' kallithea_cli_path = ${kallithea_cli_pat'
346 <%text>## settings, which may not be available on the server.</%text>
346 <%text>## settings, which may not be available on the server.</%text>
347 <%text>## See `locale -a` for valid values on this system.</%text>
347 <%text>## See `locale -a` for valid values on this system.</%text>
348 #ssh_locale = C.UTF-8
348 #ssh_locale = C.UTF-8
349 %if ssh_locale:
350 ssh_locale = ${ssh_locale}
351 %endif
349
352
350 <%text>####################################</%text>
353 <%text>####################################</%text>
351 <%text>### CELERY CONFIG ####</%text>
354 <%text>### CELERY CONFIG ####</%text>
General Comments 0
You need to be logged in to leave comments. Login now