mirror of https://github.com/jumpserver/jumpserver
perf: 完善 yaml 加载
parent
d2429f7883
commit
e193d7a942
|
@ -40,7 +40,7 @@ def get_platform_automation_methods(path, lang=None):
|
|||
continue
|
||||
|
||||
with open(path, 'r', encoding='utf8') as f:
|
||||
manifest = yaml_load_with_i18n(f, lang)
|
||||
manifest = yaml_load_with_i18n(f, lang=lang)
|
||||
check_platform_method(manifest, path)
|
||||
manifest['dir'] = os.path.dirname(path)
|
||||
manifest['params_serializer'] = generate_serializer(manifest)
|
||||
|
|
|
@ -12,7 +12,7 @@ def translate(key, i18n, lang):
|
|||
return lang_data.get(lang, key)
|
||||
|
||||
|
||||
def yaml_load_with_i18n(stream, lang):
|
||||
def yaml_load_with_i18n(stream, lang=None):
|
||||
ori_text = stream.read()
|
||||
stream = io.StringIO(ori_text)
|
||||
yaml_data = yaml.safe_load(stream)
|
||||
|
|
Loading…
Reference in New Issue