summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngus Lees <gus@inodes.org>2014-08-28 10:03:37 +1000
committerAngus Lees <gus@inodes.org>2014-08-28 10:03:37 +1000
commitfc069d154b4a504d1611cfcfb783ee68067961f4 (patch)
tree126277a71912909ed76e96231280efb18310feeb
parent118f7ea84a476604f2498fc4d28c9c2b266c717a (diff)
downloadoslo-utils-fc069d154b4a504d1611cfcfb783ee68067961f4.tar.gz
Just use int(BOOL) to convert to 1 or 0
(This is split out from I24461f4328e188c8983ad574495e11e033ec5ba4 on neutron, which was a hunt to remove "PRED and A or B" deprecated ternary idiom.) int(bool) already returns only 1 or 0 - no need to do our own explicit version. Change-Id: Ib482d6cb63ece7e1d5073fa7dc1c7daf9db8a0b3
-rw-r--r--oslo/utils/strutils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/oslo/utils/strutils.py b/oslo/utils/strutils.py
index 5550e77..26da39b 100644
--- a/oslo/utils/strutils.py
+++ b/oslo/utils/strutils.py
@@ -94,7 +94,7 @@ def int_from_bool_as_string(subject):
Useful for JSON-decoded stuff and config file parsing
"""
- return bool_from_string(subject) and 1 or 0
+ return int(bool_from_string(subject))
def bool_from_string(subject, strict=False, default=False):