From 3bbeb69487c70aa9ebc7fa69c93d6e3544a3aa68 Mon Sep 17 00:00:00 2001 From: Jason Kölker Date: Thu, 1 Dec 2011 17:21:38 -0600 Subject: use isinstance and types.* --- openstack/common/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'openstack') diff --git a/openstack/common/utils.py b/openstack/common/utils.py index 3400675..cbc45fd 100644 --- a/openstack/common/utils.py +++ b/openstack/common/utils.py @@ -60,9 +60,9 @@ def bool_from_string(subject): Useful for JSON-decoded stuff and config file parsing """ - if type(subject) == type(bool): + if isinstance(subject, types.BooleanType): return subject - if hasattr(subject, 'startswith'): # str or unicode... + if isinstance(subject, types.StringTypes): if subject.strip().lower() in ('true', 'on', '1'): return True return False -- cgit