summaryrefslogtreecommitdiffstats
path: root/openstack
diff options
context:
space:
mode:
authorSean Dague <sdague@linux.vnet.ibm.com>2012-03-22 17:32:31 -0400
committerSean Dague <sdague@linux.vnet.ibm.com>2012-03-22 17:32:31 -0400
commit34343acba97f41535b2e75866f99d58e44da088d (patch)
tree72bbec25eff7b96cce3092893041f3ed574d3e30 /openstack
parenta43bfa116dfaefe199c9b4f02344a4b4176baf01 (diff)
downloadoslo-34343acba97f41535b2e75866f99d58e44da088d.tar.gz
oslo-34343acba97f41535b2e75866f99d58e44da088d.tar.xz
oslo-34343acba97f41535b2e75866f99d58e44da088d.zip
Make 'yes' also a true boolean
Adds yes, Yes, and all other capitalizations as a true boolean. Updated unit tests to test for these. Change-Id: I97915f870dd6bba612f74f0ceb78f2399fd81a93
Diffstat (limited to 'openstack')
-rw-r--r--openstack/common/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/openstack/common/utils.py b/openstack/common/utils.py
index 8cc400a..0191036 100644
--- a/openstack/common/utils.py
+++ b/openstack/common/utils.py
@@ -55,7 +55,7 @@ def bool_from_string(subject):
Interpret a string as a boolean.
Any string value in:
- ('True', 'true', 'On', 'on', '1')
+ ('True', 'true', 'On', 'on', 'Yes', 'yes', '1')
is interpreted as a boolean True.
Useful for JSON-decoded stuff and config file parsing
@@ -63,7 +63,7 @@ def bool_from_string(subject):
if isinstance(subject, bool):
return subject
if isinstance(subject, basestring):
- if subject.strip().lower() in ('true', 'on', '1'):
+ if subject.strip().lower() in ('true', 'on', 'yes', '1'):
return True
return False