mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[CI] Format code with Black
This commit is contained in:
parent
ea5c88ca98
commit
3a8ae5be86
1 changed files with 19 additions and 5 deletions
|
@ -131,8 +131,12 @@ class SettingsConfigPanel(ConfigPanel):
|
||||||
root_password_confirm = self.new_values.pop("root_password_confirm", None)
|
root_password_confirm = self.new_values.pop("root_password_confirm", None)
|
||||||
passwordless_sudo = self.new_values.pop("passwordless_sudo", None)
|
passwordless_sudo = self.new_values.pop("passwordless_sudo", None)
|
||||||
|
|
||||||
self.values = {k: v for k, v in self.values.items() if k not in self.virtual_settings}
|
self.values = {
|
||||||
self.new_values = {k: v for k, v in self.new_values.items() if k not in self.virtual_settings}
|
k: v for k, v in self.values.items() if k not in self.virtual_settings
|
||||||
|
}
|
||||||
|
self.new_values = {
|
||||||
|
k: v for k, v in self.new_values.items() if k not in self.virtual_settings
|
||||||
|
}
|
||||||
|
|
||||||
assert all(v not in self.future_values for v in self.virtual_settings)
|
assert all(v not in self.future_values for v in self.virtual_settings)
|
||||||
|
|
||||||
|
@ -147,8 +151,12 @@ class SettingsConfigPanel(ConfigPanel):
|
||||||
|
|
||||||
if passwordless_sudo is not None:
|
if passwordless_sudo is not None:
|
||||||
from yunohost.utils.ldap import _get_ldap_interface
|
from yunohost.utils.ldap import _get_ldap_interface
|
||||||
|
|
||||||
ldap = _get_ldap_interface()
|
ldap = _get_ldap_interface()
|
||||||
ldap.update("cn=admins,ou=sudo", {"sudoOption": ["!authenticate"] if passwordless_sudo else []})
|
ldap.update(
|
||||||
|
"cn=admins,ou=sudo",
|
||||||
|
{"sudoOption": ["!authenticate"] if passwordless_sudo else []},
|
||||||
|
)
|
||||||
|
|
||||||
super()._apply()
|
super()._apply()
|
||||||
|
|
||||||
|
@ -173,7 +181,7 @@ class SettingsConfigPanel(ConfigPanel):
|
||||||
try:
|
try:
|
||||||
themes = [d for d in os.listdir(THEMEDIR) if os.path.isdir(THEMEDIR + d)]
|
themes = [d for d in os.listdir(THEMEDIR) if os.path.isdir(THEMEDIR + d)]
|
||||||
except Exception:
|
except Exception:
|
||||||
themes = ['unsplash', 'vapor', 'light', 'default', 'clouds']
|
themes = ["unsplash", "vapor", "light", "default", "clouds"]
|
||||||
toml["misc"]["portal"]["portal_theme"]["choices"] = themes
|
toml["misc"]["portal"]["portal_theme"]["choices"] = themes
|
||||||
|
|
||||||
return toml
|
return toml
|
||||||
|
@ -190,8 +198,11 @@ class SettingsConfigPanel(ConfigPanel):
|
||||||
# Specific logic for virtual setting "passwordless_sudo"
|
# Specific logic for virtual setting "passwordless_sudo"
|
||||||
try:
|
try:
|
||||||
from yunohost.utils.ldap import _get_ldap_interface
|
from yunohost.utils.ldap import _get_ldap_interface
|
||||||
|
|
||||||
ldap = _get_ldap_interface()
|
ldap = _get_ldap_interface()
|
||||||
self.values["passwordless_sudo"] = "!authenticate" in ldap.search("ou=sudo", "cn=admins", ["sudoOption"])[0].get("sudoOption", [])
|
self.values["passwordless_sudo"] = "!authenticate" in ldap.search(
|
||||||
|
"ou=sudo", "cn=admins", ["sudoOption"]
|
||||||
|
)[0].get("sudoOption", [])
|
||||||
except:
|
except:
|
||||||
self.values["passwordless_sudo"] = False
|
self.values["passwordless_sudo"] = False
|
||||||
|
|
||||||
|
@ -285,12 +296,15 @@ def trigger_post_change_hook(setting_name, old_value, new_value):
|
||||||
#
|
#
|
||||||
# ===========================================
|
# ===========================================
|
||||||
|
|
||||||
|
|
||||||
@post_change_hook("portal_theme")
|
@post_change_hook("portal_theme")
|
||||||
def regen_ssowatconf(setting_name, old_value, new_value):
|
def regen_ssowatconf(setting_name, old_value, new_value):
|
||||||
if old_value != new_value:
|
if old_value != new_value:
|
||||||
from yunohost.app import app_ssowatconf
|
from yunohost.app import app_ssowatconf
|
||||||
|
|
||||||
app_ssowatconf()
|
app_ssowatconf()
|
||||||
|
|
||||||
|
|
||||||
@post_change_hook("ssowat_panel_overlay_enabled")
|
@post_change_hook("ssowat_panel_overlay_enabled")
|
||||||
@post_change_hook("nginx_redirect_to_https")
|
@post_change_hook("nginx_redirect_to_https")
|
||||||
@post_change_hook("nginx_compatibility")
|
@post_change_hook("nginx_compatibility")
|
||||||
|
|
Loading…
Add table
Reference in a new issue