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
This commit is contained in:
Anh Tran 2017-01-16 11:44:29 +07:00
parent 7448bd3ab7
commit 0c1893611b
1 changed files with 1 additions and 3 deletions

View File

@ -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):