mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Catch boolean in is_true method of app.py
This commit is contained in:
parent
fab1ddf7bb
commit
31bedc5fa4
1 changed files with 11 additions and 5 deletions
|
@ -1546,11 +1546,17 @@ def is_true(arg):
|
|||
Boolean
|
||||
|
||||
"""
|
||||
true_list = ['yes', 'Yes', 'true', 'True' ]
|
||||
for string in true_list:
|
||||
if arg == string:
|
||||
return True
|
||||
return False
|
||||
if isinstance(arg, bool):
|
||||
return arg
|
||||
elif isinstance(arg, basestring):
|
||||
true_list = ['yes', 'Yes', 'true', 'True' ]
|
||||
for string in true_list:
|
||||
if arg == string:
|
||||
return True
|
||||
return False
|
||||
else:
|
||||
logger.debug('arg should be a boolean or a string, got %r', arg)
|
||||
return True if arg else False
|
||||
|
||||
|
||||
def random_password(length=8):
|
||||
|
|
Loading…
Add table
Reference in a new issue