diff options
author | Arnaud Legendre <arnaudleg@gmail.com> | 2014-02-27 18:47:54 -0800 |
---|---|---|
committer | Arnaud Legendre <arnaudleg@gmail.com> | 2014-02-27 18:47:54 -0800 |
commit | 6c7da4196bfe18c63ed230eb61898b29e31cdf62 (patch) | |
tree | 9f71d9dd00219d1eacbf6d6c8010c9e211287386 | |
parent | 933ab533837cd052696712155a803091aa1cd679 (diff) | |
download | oslo-vmware-6c7da4196bfe18c63ed230eb61898b29e31cdf62.tar.gz |
Replace unicode() for six.text_type
To support Python3, unicode() calls has been replaced by
six.text_type
Change-Id: Iae216e449a18f1d1108faa73ed6585d154c0cb2e
Closes-Bug: #1285952
-rw-r--r-- | oslo/vmware/api.py | 4 | ||||
-rw-r--r-- | oslo/vmware/vim.py | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/oslo/vmware/api.py b/oslo/vmware/api.py index 9efc634..634da82 100644 --- a/oslo/vmware/api.py +++ b/oslo/vmware/api.py @@ -23,6 +23,8 @@ in case of connection problems or server API call overload. import logging +import six + from oslo.vmware.common import loopingcall from oslo.vmware import exceptions from oslo.vmware.openstack.common.gettextutils import _ @@ -369,7 +371,7 @@ class VMwareAPISession(object): LOG.debug(_("Task: %s status is success."), task) raise loopingcall.LoopingCallDone(task_info) else: - error_msg = unicode(task_info.error.localizedMessage) + error_msg = six.text_type(task_info.error.localizedMessage) excep_msg = _("Task: %(task)s failed with error: " "%(error)s.") % {'task': task, 'error': error_msg} diff --git a/oslo/vmware/vim.py b/oslo/vmware/vim.py index eef6f96..d37c1db 100644 --- a/oslo/vmware/vim.py +++ b/oslo/vmware/vim.py @@ -21,6 +21,7 @@ import httplib import logging import urllib2 +import six import suds from oslo.vmware import exceptions @@ -221,13 +222,13 @@ class Vim(object): # Socket errors which need special handling; some of these # might be caused by server API call overload. - if (unicode(excep).find(ADDRESS_IN_USE_ERROR) != -1 or - unicode(excep).find(CONN_ABORT_ERROR)) != -1: + if (six.text_type(excep).find(ADDRESS_IN_USE_ERROR) != -1 or + six.text_type(excep).find(CONN_ABORT_ERROR)) != -1: raise exceptions.VimSessionOverLoadException( _("Socket error in %s.") % attr_name, excep) # Type error which needs special handling; it might be caused # by server API call overload. - elif unicode(excep).find(RESP_NOT_XML_ERROR) != -1: + elif six.text_type(excep).find(RESP_NOT_XML_ERROR) != -1: raise exceptions.VimSessionOverLoadException( _("Type error in %s.") % attr_name, excep) else: |