mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
move flags
This commit is contained in:
parent
3aa40ce3e9
commit
308348f051
@ -885,7 +885,6 @@ PLUGINS = []
|
||||
INTEGRATION_PLUGIN_GLOBALSETTING = {}
|
||||
|
||||
INTEGRATION_APPS_LOADING = True # Marks if apps were reloaded yet
|
||||
INTEGRATION_PLUGINS_RELOADING = False
|
||||
INTEGRATION_APPS_PATHS = [] # Holds all added plugin_paths
|
||||
INTEGRATION_ERRORS = {} # Holds discovering errors
|
||||
|
||||
|
@ -11,6 +11,6 @@ class PluginAppConfig(AppConfig):
|
||||
name = 'plugin'
|
||||
|
||||
def ready(self):
|
||||
if not settings.INTEGRATION_PLUGINS_RELOADING:
|
||||
if not plugins.is_loading:
|
||||
plugins.collect_plugins()
|
||||
plugins.load_plugins()
|
||||
|
@ -35,9 +35,13 @@ logger = logging.getLogger('inventree')
|
||||
|
||||
class Plugins:
|
||||
def __init__(self) -> None:
|
||||
# plugin registry
|
||||
self.plugins = {}
|
||||
self.plugins_inactive = {}
|
||||
|
||||
# flags
|
||||
self.is_loading = False
|
||||
|
||||
# region public plugin functions
|
||||
def load_plugins(self):
|
||||
"""load and activate all IntegrationPlugins"""
|
||||
@ -393,9 +397,9 @@ class Plugins:
|
||||
apps.clear_cache()
|
||||
self._try_reload(apps.populate, settings.INSTALLED_APPS)
|
||||
|
||||
settings.INTEGRATION_PLUGINS_RELOADING = True
|
||||
self.is_loading = True
|
||||
self._try_reload(apps.set_installed_apps, settings.INSTALLED_APPS)
|
||||
settings.INTEGRATION_PLUGINS_RELOADING = False
|
||||
self.is_loading = False
|
||||
|
||||
def _try_reload(self, cmd, *args, **kwargs):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user