core (constants): Bool method allow to convert from python bool to string constant for true/false (in both directions)
This commit is contained in:
parent
70dc0f26b0
commit
cc9bf9f2df
1 changed files with 5 additions and 0 deletions
|
|
@ -186,3 +186,8 @@ class Const(object):
|
|||
# XXX: we use a classmethod so we can use Const inheritance to change default options
|
||||
return(cls.LOG_OPT_COLORS, cls.LOG_OPT_LEVEL, cls.LOG_OPT_FORMAT, cls.LOG_OPT_LOGGER, cls.LOG_OPT_OUTPUT)
|
||||
|
||||
@classmethod
|
||||
def bool(cls, value):
|
||||
if isinstance(value, bool):
|
||||
return cls.BOOL_TRUE if value else cls.BOOL_FALSE
|
||||
return value.lower() == cls.BOOL_TRUE
|
||||
|
|
|
|||
Loading…
Reference in a new issue