mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Add "on" to valid boolean and refactor is_true
This commit is contained in:
parent
1cb6080778
commit
b470c9192c
2 changed files with 4 additions and 2 deletions
|
@ -2903,9 +2903,9 @@ def is_true(arg):
|
|||
if isinstance(arg, bool):
|
||||
return arg
|
||||
elif isinstance(arg, basestring):
|
||||
true_list = ['yes', 'Yes', 'true', 'True']
|
||||
true_list = ['yes', 'true', 'on']
|
||||
for string in true_list:
|
||||
if arg == string:
|
||||
if arg.lower() == string:
|
||||
return True
|
||||
return False
|
||||
else:
|
||||
|
|
|
@ -62,6 +62,8 @@ def test_settings_set():
|
|||
settings_set("example.bool", False)
|
||||
assert settings_get("example.bool") == False
|
||||
|
||||
settings_set("example.bool", "on")
|
||||
assert settings_get("example.bool") == True
|
||||
|
||||
def test_settings_set_int():
|
||||
settings_set("example.int", 21)
|
||||
|
|
Loading…
Add table
Reference in a new issue