diff --git a/src/core/constants.py b/src/core/constants.py index ebf2a872..6a6cbaa0 100644 --- a/src/core/constants.py +++ b/src/core/constants.py @@ -219,14 +219,12 @@ class Const(object): @classmethod def bool(cls, value): - """@return: bool value for any type""" - if isinstance(value, str) or isinstance(value, unicode): # dbus.String is unicode but not str - return value.lower() == cls.BOOL_TRUE - return bool(value) + """@return (bool): bool value for associated constant""" + assert isinstance(value, basestring) + return value.lower() == cls.BOOL_TRUE @classmethod - def str(cls, value): - """@return: str text value for any type""" - if isinstance(value, bool): - return cls.BOOL_TRUE if value else cls.BOOL_FALSE - return str(value) + def boolConst(cls, value): + """@return (str): constant associated to bool value""" + assert isinstance(value, bool) + return cls.BOOL_TRUE if value else cls.BOOL_FALSE