diff options
author | Jay S. Bryant <jsbryant@us.ibm.com> | 2014-03-03 16:52:54 -0600 |
---|---|---|
committer | Jay S. Bryant <jsbryant@us.ibm.com> | 2014-03-03 16:52:54 -0600 |
commit | f791605aea59a4800c6456b11fbfb9b6a3d59fc5 (patch) | |
tree | 05e2816b39b7fcf7a9521a0f37877341e35a4e41 | |
parent | ded17ababdeca41ae7bd4a104818b38f40155d73 (diff) | |
download | oslo-utils-f791605aea59a4800c6456b11fbfb9b6a3d59fc5.tar.gz |
Remove str() from LOG.* and exceptions
gettextutils is expecting to receive unicode strings
rather than basestrings. A basestring can cause an
unhandled exception in the logging code. To help avoid
such issues we should remove str() from LOG.* messages and
exceptions. We have verified that the %s formatting code
properly handle getting strings to unicode where necessary.
This patch also fixes one case where a message object was
being concatenated with '+' . This, like using str() will
cause logging to fail and needs to be fixed.
See bug https://bugs.launchpad.net/cinder/+bug/1274245 for
the original discussion of this problem.
Fix for oslo.messaging: https://review.openstack.org/90577
Change-Id: Iad7c2284c6b21322b96dc881a82bbbab4ebb208e
Closes-bug: 1286306
-rw-r--r-- | openstack/common/strutils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/openstack/common/strutils.py b/openstack/common/strutils.py index 29cd572..b49184e 100644 --- a/openstack/common/strutils.py +++ b/openstack/common/strutils.py @@ -78,7 +78,7 @@ def bool_from_string(subject, strict=False, default=False): Strings yielding False are 'f', 'false', 'off', 'n', 'no', or '0'. """ if not isinstance(subject, six.string_types): - subject = str(subject) + subject = six.text_type(subject) lowered = subject.strip().lower() |