mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
configpanel: allow other ConfigPanels to have no settings defined
This commit is contained in:
parent
e7b43c763c
commit
3a31984e3c
2 changed files with 3 additions and 1 deletions
|
@ -1801,6 +1801,7 @@ class AppConfigPanel(ConfigPanel):
|
||||||
entity_type = "app"
|
entity_type = "app"
|
||||||
save_path_tpl = os.path.join(APPS_SETTING_PATH, "{entity}/settings.yml")
|
save_path_tpl = os.path.join(APPS_SETTING_PATH, "{entity}/settings.yml")
|
||||||
config_path_tpl = os.path.join(APPS_SETTING_PATH, "{entity}/config_panel.toml")
|
config_path_tpl = os.path.join(APPS_SETTING_PATH, "{entity}/config_panel.toml")
|
||||||
|
settings_must_be_defined: bool = True
|
||||||
|
|
||||||
def _get_raw_settings(self, config: "ConfigPanelModel") -> "RawSettings":
|
def _get_raw_settings(self, config: "ConfigPanelModel") -> "RawSettings":
|
||||||
return self._call_config_script("show")
|
return self._call_config_script("show")
|
||||||
|
|
|
@ -279,6 +279,7 @@ class ConfigPanel:
|
||||||
save_path_tpl: Union[str, None] = None
|
save_path_tpl: Union[str, None] = None
|
||||||
config_path_tpl = "/usr/share/yunohost/config_{entity_type}.toml"
|
config_path_tpl = "/usr/share/yunohost/config_{entity_type}.toml"
|
||||||
save_mode = "full"
|
save_mode = "full"
|
||||||
|
settings_must_be_defined: bool = False
|
||||||
filter_key: "FilterKey" = (None, None, None)
|
filter_key: "FilterKey" = (None, None, None)
|
||||||
config: Union[ConfigPanelModel, None] = None
|
config: Union[ConfigPanelModel, None] = None
|
||||||
form: Union["FormModel", None] = None
|
form: Union["FormModel", None] = None
|
||||||
|
@ -627,7 +628,7 @@ class ConfigPanel:
|
||||||
value = option.default
|
value = option.default
|
||||||
elif option.type is OptionType.file or option.bind == "null":
|
elif option.type is OptionType.file or option.bind == "null":
|
||||||
continue
|
continue
|
||||||
else:
|
elif self.settings_must_be_defined:
|
||||||
raise YunohostError(
|
raise YunohostError(
|
||||||
f"Config panel question '{option.id}' should be initialized with a value during install or upgrade.",
|
f"Config panel question '{option.id}' should be initialized with a value during install or upgrade.",
|
||||||
raw_msg=True,
|
raw_msg=True,
|
||||||
|
|
Loading…
Add table
Reference in a new issue