summaryrefslogtreecommitdiffstats
path: root/openstack/common
diff options
context:
space:
mode:
authorChuck Short <chuck.short@canonical.com>2013-07-12 14:27:37 -0400
committerChuck Short <chuck.short@canonical.com>2013-07-12 14:32:31 -0400
commit45e0cbe52d0a29ad54105cfebd1b8d347cef7cfa (patch)
tree92c28a930d59fb3d7fe781653f516e358ab77eee /openstack/common
parentca0ca29e3f04ced20f62c33ad8b5bf7492775824 (diff)
downloadoslo-45e0cbe52d0a29ad54105cfebd1b8d347cef7cfa.tar.gz
oslo-45e0cbe52d0a29ad54105cfebd1b8d347cef7cfa.tar.xz
oslo-45e0cbe52d0a29ad54105cfebd1b8d347cef7cfa.zip
python3: Add basic python3 compatibility.
Use six.text_type to replace unicode() in python2 and str in python3. Change-Id: I61e961248241014380ec464429f2585a9497333b Signed-off-by: Chuck Short <chuck.short@canonical.com>
Diffstat (limited to 'openstack/common')
-rw-r--r--openstack/common/gettextutils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/openstack/common/gettextutils.py b/openstack/common/gettextutils.py
index 0e27425..cacdb5b 100644
--- a/openstack/common/gettextutils.py
+++ b/openstack/common/gettextutils.py
@@ -30,6 +30,8 @@ import logging.handlers
import os
import UserString
+import six
+
_localedir = os.environ.get('oslo'.upper() + '_LOCALEDIR')
_t = gettext.translation('oslo', localedir=_localedir, fallback=True)
@@ -120,7 +122,7 @@ class Message(UserString.UserString, object):
if self.params is not None:
full_msg = full_msg % self.params
- return unicode(full_msg)
+ return six.text_type(full_msg)
def _save_parameters(self, other):
# we check for None later to see if