Simplify code

This commit is contained in:
Alexandre Aubin 2022-08-04 18:21:24 +02:00 committed by GitHub
parent 7c97045fb6
commit 5494ce5def
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View file

@ -488,7 +488,7 @@
"log_user_update": "Update info for user '{}'",
"log_settings_set": "Apply settings",
"log_settings_reset": "Reset setting",
"log_settings_reset_all": "Reset all setting",
"log_settings_reset_all": "Reset all settings",
"mail_alias_remove_failed": "Could not remove e-mail alias '{mail}'",
"mail_domain_unknown": "Invalid e-mail address for domain '{domain}'. Please, use a domain administrated by this server.",
"mail_forward_remove_failed": "Could not remove e-mail forwarding '{mail}'",

View file

@ -15,10 +15,6 @@ logger = getActionLogger("yunohost.settings")
SETTINGS_PATH = "/etc/yunohost/settings.yml"
BOOLEANS = {
"True": True,
"False": False,
}
def settings_get(key="", full=False, export=False):
@ -136,8 +132,8 @@ class SettingsConfigPanel(ConfigPanel):
return self.config
# Dirty hack to let settings_get() to work from a python script
if isinstance(result, str) and result in BOOLEANS:
result = BOOLEANS[result]
if isinstance(result, str) and result in ["True", "False"]:
result = bool(result)
return result