From 1c781d9bf0e0fd7bcfb2a212579c3072cfdb944d Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 18 Sep 2021 04:32:31 +0200 Subject: [PATCH] rename --- InvenTree/InvenTree/settings.py | 2 +- InvenTree/InvenTree/urls.py | 2 +- InvenTree/plugins/integration/integration.py | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 8a44468c15..3388d7087e 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -661,6 +661,6 @@ INTEGRATION_PLUGIN_LIST = {} for plugin in INTEGRATION_PLUGINS: plugin = plugin() INTEGRATION_PLUGIN_LIST[plugin.plugin_name()] = plugin - if plugin.module_enabled('settings'): + if plugin.mixin_enabled('settings'): INTEGRATION_PLUGIN_SETTING[plugin.plugin_name()] = plugin.settingspatterns INTEGRATION_PLUGIN_SETTINGS.update(plugin.settingspatterns) diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index ee26e518ef..3f018e15ad 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -133,7 +133,7 @@ interation_urls = [] for plugin in integration_plugins: # initialize plugin = plugin() - if plugin.module_enabled('urls'): + if plugin.mixin_enabled('urls'): interation_urls.append(plugin.urlpatterns) urlpatterns = [ diff --git a/InvenTree/plugins/integration/integration.py b/InvenTree/plugins/integration/integration.py index c94042113b..651abeb928 100644 --- a/InvenTree/plugins/integration/integration.py +++ b/InvenTree/plugins/integration/integration.py @@ -86,15 +86,15 @@ class IntegrationPlugin(plugin.InvenTreePlugin): super().__init__() def add_mixin(self, key: str, fnc_enabled=True): - if not hasattr(self, 'mixins'): - self.mixins = {} - self.mixins[key] = fnc_enabled + if not hasattr(self, '_mixins'): + self._mixins = {} + self._mixins[key] = fnc_enabled - def module(self, key): - return key in self.mixins + def mixin(self, key): + return key in self._mixins - def module_enabled(self, key): - if self.module(key): - fnc_name = self.mixins.get(key) + def mixin_enabled(self, key): + if self.mixin(key): + fnc_name = self._mixins.get(key) return getattr(self, fnc_name, True) return False