diff --git a/InvenTree/common/notifications.py b/InvenTree/common/notifications.py index e52e2d86ff..819b10a000 100644 --- a/InvenTree/common/notifications.py +++ b/InvenTree/common/notifications.py @@ -133,7 +133,7 @@ class NotificationMethod: return False # Check if method globally enabled - plg_instance = registry.plugins.get(plg_cls.NAME.lower()) + plg_instance = registry.get_plugin(plg_cls.NAME.lower()) if plg_instance and not plg_instance.get_setting(self.GLOBAL_SETTING): return True diff --git a/InvenTree/plugin/base/event/events.py b/InvenTree/plugin/base/event/events.py index 01502b528c..a85d9a3b52 100644 --- a/InvenTree/plugin/base/event/events.py +++ b/InvenTree/plugin/base/event/events.py @@ -99,7 +99,7 @@ def process_event(plugin_slug, event, *args, **kwargs): This function is run by the background worker process. This function may queue multiple functions to be handled by the background worker. """ - plugin = registry.plugins.get(plugin_slug, None) + plugin = registry.get_plugin(plugin_slug) if plugin is None: # pragma: no cover logger.error("Could not find matching plugin for '%s'", plugin_slug) diff --git a/InvenTree/plugin/base/event/mixins.py b/InvenTree/plugin/base/event/mixins.py index 8f17199c5f..51c526ec7a 100644 --- a/InvenTree/plugin/base/event/mixins.py +++ b/InvenTree/plugin/base/event/mixins.py @@ -9,7 +9,7 @@ class EventMixin: Implementing classes must provide a "process_event" function: """ - def wants_process_event(self, event): + def wants_process_event(self, event: str) -> bool: """Function to subscribe to events. Return true if you're interested in the given event, false if not. @@ -17,7 +17,7 @@ class EventMixin: # Default implementation always returns true (backwards compatibility) return True - def process_event(self, event, *args, **kwargs): + def process_event(self, event: str, *args, **kwargs) -> None: """Function to handle events. Must be overridden by plugin diff --git a/InvenTree/plugin/builtin/integration/core_notifications.py b/InvenTree/plugin/builtin/integration/core_notifications.py index a988cf8287..4f9e956cf8 100644 --- a/InvenTree/plugin/builtin/integration/core_notifications.py +++ b/InvenTree/plugin/builtin/integration/core_notifications.py @@ -133,7 +133,7 @@ class InvenTreeCoreNotificationsPlugin(SettingsContentMixin, SettingsMixin, Inve def send_bulk(self): """Send the notifications out via slack.""" - instance = registry.plugins.get(self.get_plugin().NAME.lower()) + instance = registry.get_plugin(self.get_plugin().NAME.lower()) url = instance.get_setting('NOTIFICATION_SLACK_URL') if not url: diff --git a/InvenTree/plugin/builtin/integration/test_core_notifications.py b/InvenTree/plugin/builtin/integration/test_core_notifications.py index 60ed1d6d35..ae890cc0de 100644 --- a/InvenTree/plugin/builtin/integration/test_core_notifications.py +++ b/InvenTree/plugin/builtin/integration/test_core_notifications.py @@ -18,7 +18,7 @@ class CoreNotificationTestTests(BaseNotificationIntegrationTest): self.assertEqual(len(mail.outbox), 0) # enable plugin and set mail setting to true - plugin = registry.plugins.get('inventreecorenotificationsplugin') + plugin = registry.get_plugin('inventreecorenotificationsplugin') plugin.set_setting('ENABLE_NOTIFICATION_EMAILS', True) NotificationUserSetting.set_setting( key='NOTIFICATION_METHOD_MAIL',