From 49b93daa959bd6cd5188cebc6e7695f7f343d64e Mon Sep 17 00:00:00 2001 From: Schrolli Date: Wed, 8 Jul 2015 09:45:36 +0200 Subject: [PATCH] use configHandler.checkConfig() helper in template plugin for demonstration --- plugins/template/template.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/plugins/template/template.py b/plugins/template/template.py index 7218ced..33401c2 100644 --- a/plugins/template/template.py +++ b/plugins/template/template.py @@ -3,6 +3,9 @@ """ template plugin to show the function and usage of plugins +feel free to edit to yout own plugin +please edit theese desciption, the @author-Tag and the @requires-Tag +For more information take a look into the other plugins @author: Jens Herrmann @author: Bastian Schroll @@ -19,6 +22,7 @@ from includes import globals # Global variables # Helper function, uncomment to use #from includes.helper import timeHandler #from includes.helper import wildcardHandler +from includes.helper import configHandler ## # @@ -72,14 +76,7 @@ def run(typ,freq,data): # # ConfigParser # - logging.debug("reading config file") - try: - for key,val in globals.config.items("template"): - logging.debug(" - %s = %s", key, val) - except: - logging.error("cannot read config file") - logging.debug("cannot read config file", exc_info=True) - else: # Without config, plugin couldn't work + if configHandler.checkConfig("template"): #read and debug the config (let empty if no config used) ########## User Plugin CODE ########## if typ == "FMS":