Python 3: do not use the unicode() function
It is Python2-specific, and should not be used in code intended to be portable. Change-Id: Ibebef1a7e51a7444538275d22d444c926b8b4dec Closes-Bug: 1284677
This commit is contained in:
parent
46bf452710
commit
21c422f730
|
@ -250,7 +250,7 @@ def getsockopt(self, *args, **kwargs):
|
|||
|
||||
def exception_to_str(exc):
|
||||
try:
|
||||
error = unicode(exc)
|
||||
error = six.text_type(exc)
|
||||
except UnicodeError:
|
||||
try:
|
||||
error = str(exc)
|
||||
|
|
|
@ -18,6 +18,7 @@ from six.moves.urllib import parse
|
|||
|
||||
import warlock
|
||||
|
||||
from glanceclient.common import utils
|
||||
from glanceclient.openstack.common import strutils
|
||||
|
||||
DEFAULT_PAGE_SIZE = 20
|
||||
|
@ -125,7 +126,7 @@ class Controller(object):
|
|||
try:
|
||||
setattr(image, key, value)
|
||||
except warlock.InvalidOperation as e:
|
||||
raise TypeError(unicode(e))
|
||||
raise TypeError(utils.exception_to_str(e))
|
||||
|
||||
resp, body = self.http_client.json_request('POST', url, body=image)
|
||||
#NOTE(esheffield): remove 'self' for now until we have an elegant
|
||||
|
@ -146,7 +147,7 @@ class Controller(object):
|
|||
try:
|
||||
setattr(image, key, value)
|
||||
except warlock.InvalidOperation as e:
|
||||
raise TypeError(unicode(e))
|
||||
raise TypeError(utils.exception_to_str(e))
|
||||
|
||||
if remove_props is not None:
|
||||
cur_props = image.keys()
|
||||
|
|
Loading…
Reference in New Issue