From 50e5bfc4a48f7cc4ff7ea998eb835e58c5203d74 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 4 Nov 2021 12:42:22 +0100 Subject: [PATCH] flag if plugin was packaged --- InvenTree/InvenTree/settings.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index a20fb793cd..182e45f8de 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -830,6 +830,7 @@ for plugin in PLUGIN_DIRS: # Get plugins from setup entry points for entry in metadata.entry_points().get('inventree_plugins', []): plugin = entry.load() + plugin.is_package = True PLUGINS.append(plugin) # collect integration plugins @@ -838,5 +839,12 @@ INTEGRATION_PLUGIN_SETTING = {} INTEGRATION_APPS_LOADED = False # Marks if apps were reloaded yet for plugin in inventree_plugins.load_integration_plugins(): + # check if package + was_packaged = getattr(plugin, 'is_package', False) + + # init package + plugin.is_package = was_packaged plugin = plugin() + plugin.is_package = was_packaged + # safe reference INTEGRATION_PLUGINS[plugin.slug] = plugin