mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
config get: Also inject ask strings in full mode
This commit is contained in:
parent
217ae87bb3
commit
96b112ac7f
1 changed files with 16 additions and 11 deletions
|
@ -65,10 +65,6 @@ class ConfigPanel:
|
||||||
self._load_current_values()
|
self._load_current_values()
|
||||||
self._hydrate()
|
self._hydrate()
|
||||||
|
|
||||||
# Format result in full mode
|
|
||||||
if mode == "full":
|
|
||||||
return self.config
|
|
||||||
|
|
||||||
# In 'classic' mode, we display the current value if key refer to an option
|
# In 'classic' mode, we display the current value if key refer to an option
|
||||||
if self.filter_key.count(".") == 2 and mode == "classic":
|
if self.filter_key.count(".") == 2 and mode == "classic":
|
||||||
option = self.filter_key.split(".")[-1]
|
option = self.filter_key.split(".")[-1]
|
||||||
|
@ -81,13 +77,19 @@ class ConfigPanel:
|
||||||
key = f"{panel['id']}.{section['id']}.{option['id']}"
|
key = f"{panel['id']}.{section['id']}.{option['id']}"
|
||||||
if mode == "export":
|
if mode == "export":
|
||||||
result[option["id"]] = option.get("current_value")
|
result[option["id"]] = option.get("current_value")
|
||||||
|
continue
|
||||||
|
|
||||||
|
ask = None
|
||||||
|
if "ask" in option:
|
||||||
|
ask = _value_for_locale(option["ask"])
|
||||||
|
elif "i18n" in self.config:
|
||||||
|
ask = m18n.n(self.config["i18n"] + "_" + option["id"])
|
||||||
|
|
||||||
|
if mode == "full":
|
||||||
|
# edit self.config directly
|
||||||
|
option["ask"] = ask
|
||||||
else:
|
else:
|
||||||
if "ask" in option:
|
result[key] = {"ask": ask}
|
||||||
result[key] = {"ask": _value_for_locale(option["ask"])}
|
|
||||||
elif "i18n" in self.config:
|
|
||||||
result[key] = {
|
|
||||||
"ask": m18n.n(self.config["i18n"] + "_" + option["id"])
|
|
||||||
}
|
|
||||||
if "current_value" in option:
|
if "current_value" in option:
|
||||||
question_class = ARGUMENTS_TYPE_PARSERS[
|
question_class = ARGUMENTS_TYPE_PARSERS[
|
||||||
option.get("type", "string")
|
option.get("type", "string")
|
||||||
|
@ -96,7 +98,10 @@ class ConfigPanel:
|
||||||
option["current_value"], option
|
option["current_value"], option
|
||||||
)
|
)
|
||||||
|
|
||||||
return result
|
if mode == "full":
|
||||||
|
return self.config
|
||||||
|
else:
|
||||||
|
return result
|
||||||
|
|
||||||
def set(
|
def set(
|
||||||
self, key=None, value=None, args=None, args_file=None, operation_logger=None
|
self, key=None, value=None, args=None, args_file=None, operation_logger=None
|
||||||
|
|
Loading…
Add table
Reference in a new issue