summaryrefslogtreecommitdiffstats
path: root/openstack/common/rpc
diff options
context:
space:
mode:
authorChuck Short <chuck.short@canonical.com>2013-05-01 11:22:23 -0500
committerChuck Short <chuck.short@canonical.com>2013-05-06 15:52:26 -0500
commitfde1e156a38633ce9018569145390bce2047fea8 (patch)
treeff31b1d70f5e6e35cff4a40101db0ea90ed58bcb /openstack/common/rpc
parent0c9047cc334578f9f4974c3bc006ba9bc62814d2 (diff)
Convert unicode for python3 portability
From http://docs.python.org/3.1/whatsnew/3.0.html: "Python 3.0 uses the concepts of text and (binary) data instead of Unicode strings and 8-bit strings." Use six.text_type to Type for representing (Unicode) textual data. This is unicode() in Python 2 and str in Python 3. Change-Id: I3da268a714a34a8e626a2590f01b86e414dc3411 Signed-off-by: Chuck Short <chuck.short@canonical.com>
Diffstat (limited to 'openstack/common/rpc')
-rw-r--r--openstack/common/rpc/common.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/openstack/common/rpc/common.py b/openstack/common/rpc/common.py
index 2bc7c61..d74425d 100644
--- a/openstack/common/rpc/common.py
+++ b/openstack/common/rpc/common.py
@@ -22,6 +22,7 @@ import sys
import traceback
from oslo.config import cfg
+import six
from openstack.common.gettextutils import _
from openstack.common import importutils
@@ -299,7 +300,8 @@ def serialize_remote_exception(failure_info, log_failure=True):
tb = traceback.format_exception(*failure_info)
failure = failure_info[1]
if log_failure:
- LOG.error(_("Returning exception %s to caller"), unicode(failure))
+ LOG.error(_("Returning exception %s to caller"),
+ six.text_type(failure))
LOG.error(tb)
kwargs = {}
@@ -309,7 +311,7 @@ def serialize_remote_exception(failure_info, log_failure=True):
data = {
'class': str(failure.__class__.__name__),
'module': str(failure.__class__.__module__),
- 'message': unicode(failure),
+ 'message': six.text_type(failure),
'tb': tb,
'args': failure.args,
'kwargs': kwargs