configpanel: add value in options dict for config get --full

This commit is contained in:
axolotle 2023-04-24 15:09:44 +02:00
parent 48f882ecd3
commit d370cb0b24

View file

@ -363,7 +363,20 @@ class ConfigPanel:
# Format result in 'classic' or 'export' mode # Format result in 'classic' or 'export' mode
self.config.translate() self.config.translate()
logger.debug(f"Formating result in '{mode}' mode") logger.debug(f"Formating result in '{mode}' mode")
if mode == "full":
result = self.config.dict(exclude_none=True)
for panel in result["panels"]:
for section in panel["sections"]:
for opt in section["options"]:
instance = self.config.get_option(opt["id"])
if isinstance(instance, BaseInputOption):
opt["value"] = instance.normalize(self.form[opt["id"]], instance)
return result
result = OrderedDict() result = OrderedDict()
for panel in self.config.panels: for panel in self.config.panels:
for section in panel.sections: for section in panel.sections:
if section.is_action_section and mode != "full": if section.is_action_section and mode != "full":
@ -388,9 +401,6 @@ class ConfigPanel:
"value" "value"
] = "**************" # Prevent displaying password in `config get` ] = "**************" # Prevent displaying password in `config get`
if mode == "full":
return self.config.dict(exclude_none=True)
else:
return result return result
def set( def set(