From c1da585256caa2c5790ad54700de3238d2e5dc55 Mon Sep 17 00:00:00 2001 From: Eli Qiao Date: Thu, 6 Nov 2014 14:58:23 +0800 Subject: [PATCH] Use six.text_type instead of unicode According to 6683905b532b6030989064636aa5506d4cbe5b22 , we shouldn't use unicode in an exception message. Change-Id: I377f0cf7b8a66026491b75e89b470a328670f17a --- nova/api/metadata/handler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nova/api/metadata/handler.py b/nova/api/metadata/handler.py index 9862128ee03f..001f8cfa52f6 100644 --- a/nova/api/metadata/handler.py +++ b/nova/api/metadata/handler.py @@ -153,7 +153,8 @@ class MetadataRequestHandler(wsgi.Application): 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'), @@ -210,7 +211,8 @@ class MetadataRequestHandler(wsgi.Application): 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'),