mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
black settings.py
This commit is contained in:
parent
76238db4bb
commit
ce0362eef8
1 changed files with 12 additions and 9 deletions
|
@ -16,7 +16,6 @@ logger = getActionLogger("yunohost.settings")
|
|||
SETTINGS_PATH = "/etc/yunohost/settings.yml"
|
||||
|
||||
|
||||
|
||||
def settings_get(key="", full=False, export=False):
|
||||
"""
|
||||
Get an entry value in the settings
|
||||
|
@ -106,18 +105,20 @@ class SettingsConfigPanel(ConfigPanel):
|
|||
save_path_tpl = SETTINGS_PATH
|
||||
save_mode = "diff"
|
||||
|
||||
def __init__(
|
||||
self, config_path=None, save_path=None, creation=False
|
||||
):
|
||||
def __init__(self, config_path=None, save_path=None, creation=False):
|
||||
super().__init__("settings")
|
||||
|
||||
def _apply(self):
|
||||
super()._apply()
|
||||
|
||||
settings = { k: v for k, v in self.future_values.items() if self.values.get(k) != v }
|
||||
settings = {
|
||||
k: v for k, v in self.future_values.items() if self.values.get(k) != v
|
||||
}
|
||||
for setting_name, value in settings.items():
|
||||
try:
|
||||
trigger_post_change_hook(setting_name, self.values.get(setting_name), value)
|
||||
trigger_post_change_hook(
|
||||
setting_name, self.values.get(setting_name), value
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Post-change hook for setting failed : {e}")
|
||||
raise
|
||||
|
@ -128,7 +129,9 @@ class SettingsConfigPanel(ConfigPanel):
|
|||
if mode == "full":
|
||||
for panel, section, option in self._iterate():
|
||||
if m18n.key_exists(self.config["i18n"] + "_" + option["id"] + "_help"):
|
||||
option["help"] = m18n.n(self.config["i18n"] + "_" + option["id"] + "_help")
|
||||
option["help"] = m18n.n(
|
||||
self.config["i18n"] + "_" + option["id"] + "_help"
|
||||
)
|
||||
return self.config
|
||||
|
||||
# Dirty hack to let settings_get() to work from a python script
|
||||
|
@ -137,7 +140,7 @@ class SettingsConfigPanel(ConfigPanel):
|
|||
|
||||
return result
|
||||
|
||||
def reset(self, key = "", operation_logger=None):
|
||||
def reset(self, key="", operation_logger=None):
|
||||
self.filter_key = key
|
||||
|
||||
# Read config panel toml
|
||||
|
|
Loading…
Add table
Reference in a new issue