Replace unicode() for six.text_type

To support Python3, unicode() calls has been replaced by
six.text_type.
Added utils.exception_to_str(): is the proper way to convert
an exception to string, since it manages logic related to
encoding.

Change-Id: I27101390e4f95e5c7690b1b445b7e75b8bcb9a08
Closes-Bug: #1284677
This commit is contained in:
Leandro I. Costantino
2014-03-26 09:35:25 -03:00
parent ed816a214b
commit 627d5fbc13
29 changed files with 156 additions and 137 deletions

View File

@@ -18,6 +18,7 @@ Reference implementation registry server WSGI controller
"""
from oslo.config import cfg
import six
from webob import exc
from glance.common import exception
@@ -481,7 +482,7 @@ class Controller(object):
request=req,
content_type='text/plain')
except exception.Conflict as e:
LOG.info(unicode(e))
LOG.info(six.text_type(e))
raise exc.HTTPConflict(body='Image operation conflicts',
request=req,
content_type='text/plain')