From 0c7f5102d44f1070a0a9224f68d986813ac75ff3 Mon Sep 17 00:00:00 2001 From: Andre Zoledziowski Date: Thu, 28 Jun 2018 10:32:54 +0200 Subject: [PATCH] BugFix: KCCOMMENT and KCUNCOMMENT buggy --- core/kcconf.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/kcconf.py b/core/kcconf.py index 0dd54ab..d6f5f83 100644 --- a/core/kcconf.py +++ b/core/kcconf.py @@ -41,17 +41,21 @@ def parseenvironmentvariables(prependingpath): commentmatch = re.match(r"^KCCOMMENT_([A-Z]+)_([A-Z0-9_]+)$", name) if commentmatch != None: filename = commentmatch.group(1).lower() + ".cfg" + if prependingpath + filename not in configs: + configs[prependingpath + filename] = dict() try: configs[prependingpath + filename]["kccomment"].append(value) - except IndexError: + except KeyError: configs[prependingpath + filename]["kccomment"] = [] configs[prependingpath + filename]["kccomment"].append(value) uncommentmatch = re.match(r"^KCUNCOMMENT_([A-Z]+)_([A-Z0-9_]+)$", name) if uncommentmatch != None: filename = uncommentmatch.group(1).lower() + ".cfg" + if prependingpath + filename not in configs: + configs[prependingpath + filename] = dict() try: - configs[prependingpath + filename]["kunccomment"].append(value) - except IndexError: - configs[prependingpath + filename]["kunccomment"] = [] - configs[prependingpath + filename]["kunccomment"].append(value) + configs[prependingpath + filename]["kcuncomment"].append(value) + except KeyError: + configs[prependingpath + filename]["kcuncomment"] = [] + configs[prependingpath + filename]["kcuncomment"].append(value) return configs