Mercurial > libervia-backend
comparison src/core/constants.py @ 1143:3164b509bc99
core (constants): Bool method allow to convert from python bool to string constant for true/false (in both directions)
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 27 Aug 2014 01:27:05 +0200 |
parents | edd3fc4b4aaf |
children | 0abce7f17782 |
comparison
equal
deleted
inserted
replaced
1142:2f9f735334da | 1143:3164b509bc99 |
---|---|
184 def LOG_OPTIONS(cls): | 184 def LOG_OPTIONS(cls): |
185 """Return options checked for logs""" | 185 """Return options checked for logs""" |
186 # XXX: we use a classmethod so we can use Const inheritance to change default options | 186 # XXX: we use a classmethod so we can use Const inheritance to change default options |
187 return(cls.LOG_OPT_COLORS, cls.LOG_OPT_LEVEL, cls.LOG_OPT_FORMAT, cls.LOG_OPT_LOGGER, cls.LOG_OPT_OUTPUT) | 187 return(cls.LOG_OPT_COLORS, cls.LOG_OPT_LEVEL, cls.LOG_OPT_FORMAT, cls.LOG_OPT_LOGGER, cls.LOG_OPT_OUTPUT) |
188 | 188 |
189 @classmethod | |
190 def bool(cls, value): | |
191 if isinstance(value, bool): | |
192 return cls.BOOL_TRUE if value else cls.BOOL_FALSE | |
193 return value.lower() == cls.BOOL_TRUE |