From 672d57917cbb2ba8b5695e737ecb145d5e0325a2 Mon Sep 17 00:00:00 2001 From: Dave McCowan Date: Thu, 23 Mar 2017 16:55:12 -0400 Subject: [PATCH] Fix TypeError with Python 3.5 Python 3.5 libraries expect HTTP headers to be of string type, not bytes. Python 2.7 doesn't care. This patch changes the type of a headers from bytes to string. Change-Id: I22a57d6a7b390ada712fed3b40f00510229c253d Closes-bug: #1675553 --- barbican/api/middleware/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barbican/api/middleware/context.py b/barbican/api/middleware/context.py index a036877d5..c0b0067a4 100644 --- a/barbican/api/middleware/context.py +++ b/barbican/api/middleware/context.py @@ -28,7 +28,7 @@ class BaseContextMiddleware(mw.Middleware): def process_request(self, req): request_id = req.headers.get('x-openstack-request-id') if not request_id: - request_id = b'req-' + utils.generate_uuid().encode('ascii') + request_id = 'req-' + utils.generate_uuid() setattr(req, 'request_id', request_id) def process_response(self, resp):