Skip to content

Commit

Permalink
Use six.text_type instead of unicode
Browse files Browse the repository at this point in the history
According to 6683905 ,
we shouldn't use unicode in an exception message.

Change-Id: I377f0cf7b8a66026491b75e89b470a328670f17a
  • Loading branch information
Eli Qiao committed Nov 6, 2014
1 parent 1a45b22 commit c1da585
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nova/api/metadata/handler.py
Expand Up @@ -153,7 +153,8 @@ def _handle_remote_ip_request(self, req):
remote_address)
msg = _('An unknown error has occurred. '
'Please try your request again.')
raise webob.exc.HTTPInternalServerError(explanation=unicode(msg))
raise webob.exc.HTTPInternalServerError(
explanation=six.text_type(msg))

if meta_data is None:
LOG.error(_LE('Failed to get metadata for ip: %s'),
Expand Down Expand Up @@ -210,7 +211,8 @@ def _handle_instance_id_request(self, req):
instance_id)
msg = _('An unknown error has occurred. '
'Please try your request again.')
raise webob.exc.HTTPInternalServerError(explanation=unicode(msg))
raise webob.exc.HTTPInternalServerError(
explanation=six.text_type(msg))

if meta_data is None:
LOG.error(_LE('Failed to get metadata for instance id: %s'),
Expand Down

0 comments on commit c1da585

Please sign in to comment.