From 8a2bf269ba7f45e2f026a79e73697bbf88b1a199 Mon Sep 17 00:00:00 2001 From: Charles Short Date: Mon, 12 Jul 2021 14:18:03 -0400 Subject: [PATCH] py3: use real division operator "/" operator using integers as both left-hand and right-hand expressions returns floor division in python2 and real division in python3. Use "//" instead to do real division for both python versions. Story: 2006796 Task: 42817 Signed-off-by: Charles Short Change-Id: Id8ac605d0184e70aa92717d8d3ce97bf8b7922cf (cherry picked from commit bcf4a4915f526378399e6578829ef65b450d3ec6) --- .../sm-api/sm_api/api/middleware/parsable_error.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service-mgmt-api/sm-api/sm_api/api/middleware/parsable_error.py b/service-mgmt-api/sm-api/sm_api/api/middleware/parsable_error.py index 8f0c4db0..5114b3f6 100644 --- a/service-mgmt-api/sm-api/sm_api/api/middleware/parsable_error.py +++ b/service-mgmt-api/sm-api/sm_api/api/middleware/parsable_error.py @@ -59,7 +59,7 @@ class ParsableErrorMiddleware(object): 'status %s' % status )) else: - if (state['status_code'] / 100) not in (2, 3): + if (state['status_code'] // 100) not in (2, 3): # Remove some headers so we can replace them later # when we have the full error message and can # compute the length. @@ -72,7 +72,7 @@ class ParsableErrorMiddleware(object): return start_response(status, headers, exc_info) app_iter = self.app(environ, replacement_start_response) - if (state['status_code'] / 100) not in (2, 3): + if (state['status_code'] // 100) not in (2, 3): req = webob.Request(environ) if (req.accept.best_match( ['application/json', 'application/xml']) ==