mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
fix . set operation still not working.
This commit is contained in:
parent
132085bceb
commit
e16f14f794
2 changed files with 8 additions and 3 deletions
|
@ -557,7 +557,7 @@ domain:
|
||||||
api: GET /domains/<domain>/settings
|
api: GET /domains/<domain>/settings
|
||||||
arguments:
|
arguments:
|
||||||
domain:
|
domain:
|
||||||
help: Domaine name
|
help: Domain name
|
||||||
key:
|
key:
|
||||||
help: Key to get/set
|
help: Key to get/set
|
||||||
-v:
|
-v:
|
||||||
|
|
|
@ -745,16 +745,20 @@ def domain_setting(domain, key, value=None, delete=False):
|
||||||
# TODO add locales
|
# TODO add locales
|
||||||
raise YunohostError("domain_name_unknown", domain=domain)
|
raise YunohostError("domain_name_unknown", domain=domain)
|
||||||
|
|
||||||
domain_settings = _get_domain_settings(domain, False) or {}
|
domain_settings = domains[domain]
|
||||||
|
|
||||||
# GET
|
# GET
|
||||||
if value is None and not delete:
|
if value is None and not delete:
|
||||||
return domain_settings.get(key, None)
|
if not key in domain_settings:
|
||||||
|
raise YunohostValidationError("This key doesn't exist!")
|
||||||
|
|
||||||
|
return domain_settings[key]
|
||||||
|
|
||||||
# DELETE
|
# DELETE
|
||||||
if delete:
|
if delete:
|
||||||
if key in domain_settings:
|
if key in domain_settings:
|
||||||
del domain_settings[key]
|
del domain_settings[key]
|
||||||
|
_set_domain_settings(domain, domain_settings)
|
||||||
|
|
||||||
# SET
|
# SET
|
||||||
else:
|
else:
|
||||||
|
@ -770,6 +774,7 @@ def domain_setting(domain, key, value=None, delete=False):
|
||||||
# TODO add locales
|
# TODO add locales
|
||||||
raise YunohostError("must_be_positive", value_type=type(ttl))
|
raise YunohostError("must_be_positive", value_type=type(ttl))
|
||||||
domain_settings[key] = value
|
domain_settings[key] = value
|
||||||
|
_set_domain_settings(domain, domain_settings)
|
||||||
|
|
||||||
def _get_domain_settings(domain, subdomains):
|
def _get_domain_settings(domain, subdomains):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue