mirror of https://github.com/jumpserver/jumpserver
perf: yaml文件读取使用utf-8编码
parent
7708812556
commit
a1ed59d116
|
@ -39,7 +39,7 @@ def get_platform_automation_methods(path):
|
||||||
if not path.endswith('manifest.yml'):
|
if not path.endswith('manifest.yml'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
with open(path, 'r') as f:
|
with open(path, 'r', encoding='utf8') as f:
|
||||||
manifest = yaml_load_with_i18n(f)
|
manifest = yaml_load_with_i18n(f)
|
||||||
check_platform_method(manifest, path)
|
check_platform_method(manifest, path)
|
||||||
manifest['dir'] = os.path.dirname(path)
|
manifest['dir'] = os.path.dirname(path)
|
||||||
|
|
|
@ -84,7 +84,7 @@ class Applet(JMSBaseModel):
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
raise ValidationError({'error': _('Applet pkg not valid, Missing file {}').format(name)})
|
raise ValidationError({'error': _('Applet pkg not valid, Missing file {}').format(name)})
|
||||||
|
|
||||||
with open(os.path.join(d, 'manifest.yml')) as f:
|
with open(os.path.join(d, 'manifest.yml'), encoding='utf8') as f:
|
||||||
manifest = yaml_load_with_i18n(f)
|
manifest = yaml_load_with_i18n(f)
|
||||||
|
|
||||||
if not manifest.get('name', ''):
|
if not manifest.get('name', ''):
|
||||||
|
@ -99,7 +99,7 @@ class Applet(JMSBaseModel):
|
||||||
if not os.path.exists(os.path.join(d, 'platform.yml')):
|
if not os.path.exists(os.path.join(d, 'platform.yml')):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
with open(os.path.join(d, 'platform.yml')) as f:
|
with open(os.path.join(d, 'platform.yml'), encoding='utf8') as f:
|
||||||
data = yaml_load_with_i18n(f)
|
data = yaml_load_with_i18n(f)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise ValidationError({'error': _('Load platform.yml failed: {}').format(e)})
|
raise ValidationError({'error': _('Load platform.yml failed: {}').format(e)})
|
||||||
|
|
Loading…
Reference in New Issue