Refactor Config class to ignore non-editable variables managed by specific methods

This commit is contained in:
Théophile Diot 2024-10-24 16:27:31 +02:00
parent 8cf603526d
commit 6e43766e23
No known key found for this signature in database
GPG key ID: FA995104A0BA376A

View file

@ -162,7 +162,12 @@ class Config:
elif setting not in config and plugins_settings[setting]["default"] == v:
variables.pop(k)
continue
elif not new and setting != "IS_DRAFT" and setting in config and config[setting]["method"] not in ("default", "ui"):
elif (
not new
and setting != "IS_DRAFT"
and setting in config
and ((global_config or not config[setting]["global"]) and config[setting]["method"] not in ("default", "ui"))
):
message = f"Variable {k} is not editable as is it managed by the {config[setting]['method']}, ignoring it"
if threaded:
self.__data["TO_FLASH"].append({"content": message, "type": "error"})