Skip to content
Snippets Groups Projects
Forked from DM / dm-docs
261 commits behind, 825 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
valueUtility.py 463 B
#!/usr/bin/env python

class ValueUtility:

    @classmethod
    def toBoolean(cls, value):
        if value is None:
            return False
        strValue = str(value).lower()
        if strValue == '1':
            return True
        elif strValue == 'true':
            return True
        return False

#######################################################################
# Testing.
if __name__ == '__main__':
    print ValueUtility.toBoolean('True')