Skip to content
Snippets Groups Projects
Commit e68faf97 authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

set_conf: fix condition | refs #27883

parent 584f20c9
No related branches found
No related tags found
No related merge requests found
......@@ -236,9 +236,10 @@ def set_conf(key: str, value: str, override: bool = False) -> bool:
regex = re.compile(r"^" + key.upper() + "=(.*)$", flags=re.M)
match = regex.search(conf)
if match and override:
# override option
conf = regex.sub("{}='{}'".format(key.upper(), str(value)), conf)
state = True
else:
elif not match:
# add option
conf = conf + "\n{}='{}'\n".format(key.upper(), str(value))
state = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment