Skip to content

Commit

Permalink
Update config handling in config.py
Browse files Browse the repository at this point in the history
Refactored the config handling in config.py to remove paths and options keys if their corresponding values are None or empty. Previously, such key-value pairs were left unaddressed, potentially leading to problems with interpreting the configuration.
  • Loading branch information
cbusillo committed Jun 24, 2024
1 parent 0bb82d8 commit 85f4b39
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions bd_to_avp/modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,15 @@ def save_config_to_file(self) -> None:
if key == "app":
continue
elif "_path" in key:
if not value:
continue
config_parser.set("Paths", key, value.as_posix())
if value:
config_parser.set("Paths", key, value.as_posix())
else:
config_parser.remove_option("Paths", key)
else:
if value is None:
continue
config_parser.set("Options", key, str(value))
if value:
config_parser.set("Options", key, str(value))
else:
config_parser.remove_option("Options", key)

with open(self.app.config_file, "w") as config_file:
config_parser.write(config_file)
Expand Down

0 comments on commit 85f4b39

Please sign in to comment.