diff --git a/module/filter/modeFilter.py b/module/filter/modeFilter.py index cc37188..fa4bebc 100644 --- a/module/filter/modeFilter.py +++ b/module/filter/modeFilter.py @@ -29,10 +29,11 @@ class BoswatchModule(Module): """!Filter of specific bwPacket mode""" def __init__(self, config): """!Do not change anything here!""" - super().__init__(__name__, config) # you can access the config DICT by 'self._config' + super().__init__(__name__, config) # you can access the config class on 'self.config' def onLoad(self): """!Called by import of the plugin""" + print(self.config) pass def doWork(self, bwPacket): @@ -41,7 +42,7 @@ class BoswatchModule(Module): @param bwPacket: A BOSWatch packet instance @return bwPacket or False""" - for mode in self.config.get("allowed"): + for mode in self.config.get("allowed", default=[]): if bwPacket.get("mode") == mode: logging.debug("mode is allowed: %s", bwPacket.get("mode")) return None diff --git a/module/template_module.py b/module/template_module.py index 15eb12e..add7047 100644 --- a/module/template_module.py +++ b/module/template_module.py @@ -29,7 +29,7 @@ class BoswatchModule(Module): """!Description of the Module""" def __init__(self, config): """!Do not change anything here!""" - super().__init__(__name__, config) # you can access the config DICT by 'self._config' + super().__init__(__name__, config) # you can access the config class on 'self.config' def onLoad(self): """!Called by import of the plugin""" diff --git a/plugin/template_plugin.py b/plugin/template_plugin.py index 99fb80c..87b7ff3 100644 --- a/plugin/template_plugin.py +++ b/plugin/template_plugin.py @@ -29,7 +29,7 @@ class BoswatchPlugin(Plugin): """!Description of the Plugin""" def __init__(self, config): """!Do not change anything here!""" - super().__init__(__name__, config) # you can access the config DICT by 'self._config' + super().__init__(__name__, config) # you can access the config class on 'self.config' def onLoad(self): """!Called by import of the plugin"""