def list(loadpath=None): all_modules_config = Xcache.list_moduleconfigs() if all_modules_config is None: PostModuleConfig.load_all_modules_config() all_modules_config = Xcache.list_moduleconfigs() # 删除内部模块 for one in all_modules_config[:]: if one.get('MODULETYPE') == TAG2CH.internal: all_modules_config.remove(one) if loadpath is None: for one in all_modules_config: one['OPTIONS'] = [] context = list_data_return(200, CODE_MSG.get(200), all_modules_config) return context else: for one_module_config in all_modules_config: if one_module_config.get('loadpath') == loadpath: # 动态处理handler和凭证选项 new_module_config = PostModuleConfig._deal_dynamic_option( one_module_config=one_module_config) context = dict_data_return(200, CODE_MSG.get(200), new_module_config) return context # 没有找到模块 context = dict_data_return(200, CODE_MSG.get(200), {}) return context
def update(): PostModuleConfig.load_all_modules_config() all_modules_config = Xcache.list_moduleconfigs() for one in all_modules_config: one['OPTIONS'] = [] context = list_data_return(201, PostModuleConfig_MSG.get(201), all_modules_config) return context