From ef2c8c9a219ee8ed23ff414c0ea5269140241b49 Mon Sep 17 00:00:00 2001 From: Ulrich Date: Tue, 6 Sep 2022 00:05:43 +0200 Subject: [PATCH] bugfixes --- basic/program.py | 2 +- basic/text_const.py | 2 ++ basic/toolHandling.py | 3 ++- test/test_02css.py | 9 +++++---- utils/conn_tool.py | 6 +----- utils/css_tool.py | 12 +++++++----- utils/path_tool.py | 2 +- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/basic/program.py b/basic/program.py index 4a646f7..a4c01df 100644 --- a/basic/program.py +++ b/basic/program.py @@ -504,8 +504,8 @@ class Parameter: class Configuration: def __init__ (self, job, program): self.program = program - print (f"job initialisiert {self.program}") path = utils.path_tool.getBasisConfigPath() + print ("conf initialisieren "+self.program+" > "+path) self.setConfiguration(job, path) return diff --git a/basic/text_const.py b/basic/text_const.py index 79d93c7..f227019 100644 --- a/basic/text_const.py +++ b/basic/text_const.py @@ -1,5 +1,7 @@ # ----------------- +EXP_PATH_MISSING = "path is missing {}" +EXP_CONFIG_MISSING = "config is missing {}" EXP_KEY_MISSING = "key is missing {}" EXP_KEY_DOESNT_EXIST = "key {} doesnt exist in domain {}" LIST_EXP_TEXT = [EXP_KEY_MISSING, EXP_KEY_DOESNT_EXIST] diff --git a/basic/toolHandling.py b/basic/toolHandling.py index c875973..e830e80 100644 --- a/basic/toolHandling.py +++ b/basic/toolHandling.py @@ -63,7 +63,8 @@ def getTool(technicType, comp, job): # class ToolManager: def getDbTool(job, comp, dbtype=""): verify = int(job.getDebugLevel("db_tool")) - dbtype = getCompAttr(comp, B.TOPIC_NODE_DB, B.ATTR_TYPE, "") + if len(dbtype) < 3: + dbtype = getCompAttr(comp, B.TOPIC_NODE_DB, B.ATTR_TYPE, "") toolname = "db"+dbtype+"_tool" filepath = os.path.join(job.conf.confs[B.SUBJECT_PATH][B.ATTR_PATH_PROGRAM], "utils", toolname+".py") #comp.m.debug(verify, "toolname "+filepath) diff --git a/test/test_02css.py b/test/test_02css.py index 4659c5e..5b92700 100644 --- a/test/test_02css.py +++ b/test/test_02css.py @@ -5,6 +5,7 @@ import unittest import utils.css_tool import basic.program import test.testtools +import basic.constants as B # the list of TEST_FUNCTIONS defines which function will be really tested. # if you minimize the list you can check the specific test-function @@ -24,8 +25,8 @@ class MyTestCase(unittest.TestCase): "modus": "unit"} job.par.setParameterArgs(job, args) # ------- inline --------------- - job.conf.setConfig("tools.csstyp", "inline") - job.conf.confs.get("tools")["csstyp"] == "inline" + job.conf.setConfig("tool.css.type", "inline") + job.conf.confs.get(B.SUBJECT_TOOL).get("css").get("typ") == "inline" text = utils.css_tool.getInlineStyle(job, "diffFiles", "diffA") self.assertEqual(len(text), 37) self.assertEqual(("style" in text), True) @@ -40,7 +41,7 @@ class MyTestCase(unittest.TestCase): text = utils.css_tool.getExternalStyle(job, "diffFiles") self.assertEqual(len(text), 0) # ------- internal --------------- - job.conf.setConfig("tools.csstyp", "internal") + job.conf.setConfig("tool.css.type", "internal") text = utils.css_tool.getInlineStyle(job, "diffFiles", "diffA") self.assertEqual(len(text), 13) self.assertEqual(("class" in text), True) @@ -64,7 +65,7 @@ class MyTestCase(unittest.TestCase): if verbose: print(text) if verbose: print(str(len(text))) # ------- external --------------- - job.conf.setConfig("tools.csstyp", "external") + job.conf.setConfig("tool.css.type", "external") text = utils.css_tool.getInlineStyle(job, "diffFiles", "diffA") self.assertEqual(len(text), 13) self.assertEqual(("class" in text), True) diff --git a/utils/conn_tool.py b/utils/conn_tool.py index 46a94c6..deffbe7 100644 --- a/utils/conn_tool.py +++ b/utils/conn_tool.py @@ -13,7 +13,7 @@ def getConnection(job, comp, nr): #job = basic.program.Job.getInstance() verify = job.getDebugLevel("conn_tool") conn = {} - if job.conf.confs.get("tools").get("connsrc") == D.DFILE_TYPE_YML: + if job.conf.confs.get(B.SUBJECT_TOOL).get("connsrc") == D.DFILE_TYPE_YML: conn = utils.config_tool.getConfig(job, "tool", B.SUBJECT_CONN) xtypes = None if ("types" in conn["env"][comp]): @@ -25,10 +25,6 @@ def getConnection(job, comp, nr): return conn["env"][comp][instnr] else: job.m.setFatal("Conn-Tool: Comp not configured " + comp + " " + str(nr)) - elif job.conf.confs.get("tools").get("connsrc") == "flaskdb": - pass - elif job.conf.confs.get("tools").get("connsrc") == D.DFILE_TYPE_CSV: - pass return None diff --git a/utils/css_tool.py b/utils/css_tool.py index b63aa1e..a2d7dfe 100644 --- a/utils/css_tool.py +++ b/utils/css_tool.py @@ -1,4 +1,6 @@ import basic.program +import basic.constants as B + CSS_CLASS = { "general": { "table, td, th": "border: 1px solid grey;font-family:sans-serif" @@ -23,7 +25,7 @@ def getInlineStyle(job, filetype, cssclass): #job = basic.program.Job.getInstance() verify = int(job.getDebugLevel("css_tool")) - 1 # job.debug(verify, "getDiffHeader ") - if job.conf.confs.get("tools").get("csstyp") == "inline": + if job.conf.confs.get(B.SUBJECT_TOOL).get("css").get("type") == "inline": out = "style=\""+CSS_CLASS[filetype][cssclass]+"\"" else: out = "class=\"" + cssclass + "\"" @@ -33,7 +35,7 @@ def getInternalStyle(job, filetype): #job = basic.program.Job.getInstance() verify = int(job.getDebugLevel("match_tool")) - 1 out = "" - if job.conf.confs.get("tools").get("csstyp") == "internal": + if job.conf.confs.get(B.SUBJECT_TOOL).get("css").get("type") == "internal": out = "" - elif job.conf.confs.get("tools").get("csstyp") == "external": - out = " " + elif job.conf.confs.get(B.SUBJECT_TOOL).get("css").get("type") == "external": + out = " " else: out = "