From 8fc2610a9d0b64031bf9f34f9ba2f57e9bc7b40e Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 3 Oct 2021 14:16:21 +0200 Subject: [PATCH] simplify loading --- InvenTree/InvenTree/settings.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 49e2a38d1e..3ba94315d7 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -659,15 +659,19 @@ MESSAGE_TAGS = { PLUGIN_URL = 'plugin' INTEGRATION_PLUGINS = [] -for plugin in inventree_plugins.load_integration_plugins(): - INTEGRATION_PLUGINS.append(plugin()) INTEGRATION_PLUGIN_SETTINGS = {} INTEGRATION_PLUGIN_SETTING = {} INTEGRATION_PLUGIN_LIST = {} -for plugin in INTEGRATION_PLUGINS: - INTEGRATION_PLUGIN_LIST[plugin.plugin_name()] = plugin +for plugin in inventree_plugins.load_integration_plugins(): + plugin = plugin() + plugin_name = plugin.plugin_name() + + INTEGRATION_PLUGINS.append(plugin) + INTEGRATION_PLUGIN_LIST[plugin_name] = plugin if plugin.mixin_enabled('settings'): - INTEGRATION_PLUGIN_SETTING[plugin.plugin_name()] = plugin.settingspatterns - INTEGRATION_PLUGIN_SETTINGS.update(plugin.settingspatterns) + plugin_setting = plugin.settingspatterns + + INTEGRATION_PLUGIN_SETTING[plugin_name] = plugin_setting + INTEGRATION_PLUGIN_SETTINGS.update(plugin_setting)