From 27e4ea5b5b0a0cffe61b82de1342359ac9cd738e Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 13 Feb 2019 15:14:35 +0100 Subject: [PATCH] Support for both enabled and disabled flags on plugin level --- platypush/context/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platypush/context/__init__.py b/platypush/context/__init__.py index c7f96cfef..9614b5c73 100644 --- a/platypush/context/__init__.py +++ b/platypush/context/__init__.py @@ -93,6 +93,16 @@ def get_plugin(plugin_name, reload=False): plugin_conf = Config.get_plugins()[plugin_name] \ if plugin_name in Config.get_plugins() else {} + if 'disabled' in plugin_conf: + if plugin_conf['disabled'] is True: + return None + del plugin_conf['disabled'] + + if 'enabled' in plugin_conf: + if plugin_conf['enabled'] is False: + return None + del plugin_conf['enabled'] + try: plugin_class = getattr(plugin, cls_name) except AttributeError as e: