# -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab import types __author__ = 'frank' def toBoolean(value): """Converts a string to a boolean. Checks whether the given value is a string type and converts it to boolean. In all other cases, the value is returned without alteration.""" if isinstance(value, types.StringTypes): if value.lower() == "true": return True else: return False else: return value