From 1ab3b61ef41b8ed7ff13b0febdc55ab4158aab93 Mon Sep 17 00:00:00 2001 From: Schrolli Date: Wed, 8 Jul 2015 09:42:52 +0200 Subject: [PATCH] insert helper configHandler.py little edit in wildcardHandler.py error message --- includes/helper/configHandler.py | 37 ++++++++++++++++++++++++++++++ includes/helper/wildcardHandler.py | 4 ++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 includes/helper/configHandler.py diff --git a/includes/helper/configHandler.py b/includes/helper/configHandler.py new file mode 100644 index 0000000..8dfe90e --- /dev/null +++ b/includes/helper/configHandler.py @@ -0,0 +1,37 @@ +#!/usr/bin/python +# -*- coding: cp1252 -*- +# + +""" +little Helper to handle config data +for direct use in plugins to save code + +@author: Bastian Schroll +""" + +import logging +from includes import globals + + +def checkConfig(section=""): + """ + Reads the config option from an section and prints it to debug log + + @type section: string + @param section: Section name from config.ini + + @return: true (false if reading failed) + @exception: Exception if Error at read an debug + """ + try: + if section is not "": # read only data if section is given + logging.debug("read [%s] from config file", section) + + for key,val in globals.config.items(section): + logging.debug(" - %s = %s", key, val) + + return True + except: + logging.warning("error in config read/debug") + logging.debug("error in config read/debug", exc_info=True) + return False diff --git a/includes/helper/wildcardHandler.py b/includes/helper/wildcardHandler.py index a7895b9..1b85b96 100644 --- a/includes/helper/wildcardHandler.py +++ b/includes/helper/wildcardHandler.py @@ -55,5 +55,5 @@ def replaceWildcards(text,data): return text except: - logging.warning("error wildcard replacement") - logging.debug("error wildcard replacement", exc_info=True) + logging.warning("error in wildcard replacement") + logging.debug("error in wildcard replacement", exc_info=True)