fixes for configparser.get for files in configdir

This commit is contained in:
Marcus Stoegbauer 2024-03-30 00:25:35 +01:00
parent 4790429f24
commit e82fd99a16
1 changed files with 5 additions and 5 deletions

View File

@ -38,12 +38,12 @@ def get_config(filename, cfg):
cfg.debug.stderr("Error reading config file %s" % filename)
return False
# check for DEST parameter
if not ret.check("Main", "dest"):
if not ret.check(section="Main", option="dest"):
cfg.debug.stderr("No dest in config file %s" % filename)
return False
# make sure DEST ends with /
if not ret.get("Main", "dest").endswith("/"):
ret.set("Main", "dest", ret.get("Main", "dest")+"/")
if not ret.get(section="Main", option="dest").endswith("/"):
ret.set(section="Main", option="dest", value=ret.get(section="Main", option="dest")+"/")
return ret
@ -95,14 +95,14 @@ def user_config_generated(filename, cfg):
# filename does not exist, so it was not generated by userconfig
return False
if not cfg.check("Main", "stamp"):
if not cfg.check("stamp"):
# no STAMP in userconfig.cfg, so no way to check if file was generated by userconfig
return False
fp = open(filename, "r")
for line in fp:
if re.search(re.escape(cfg.get("Main", "stamp")), line):
if re.search(re.escape(cfg.get("stamp")), line):
return True
return False