From 0c1893611b6abf5a51356d7c3d3e6ed3178bc7ec Mon Sep 17 00:00:00 2001 From: Anh Tran Date: Mon, 16 Jan 2017 11:44:29 +0700 Subject: [PATCH] Replace str(uuid.uuid4()) with utils.generate_uuid() barbican aleady has utils.generate_uuid() which was returned str(uuid.uuid4()) so we don't need to import uuid again. Change-Id: I9a106b4a1b2a9b2cb4319b0f88d574c4138953a2 --- barbican/api/middleware/context.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/barbican/api/middleware/context.py b/barbican/api/middleware/context.py index bc954d7f..a036877d 100644 --- a/barbican/api/middleware/context.py +++ b/barbican/api/middleware/context.py @@ -12,8 +12,6 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -import uuid - import webob.exc from barbican.api import middleware as mw @@ -30,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-' + str(uuid.uuid4()).encode('ascii') + request_id = b'req-' + utils.generate_uuid().encode('ascii') setattr(req, 'request_id', request_id) def process_response(self, resp):