From 0153a20201cfeff37512733b2e85106f69ba5f47 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 6 Jun 2018 17:29:42 -0400 Subject: [PATCH] replace use of 'unicode' builtin The builtin type 'unicode' does not exist under python 3. The runtime check here is already looking at the python version, but the linter does not perform the same check and it fails because the name is not defined. Replace the explicit use of unicode here with six.text_type so that the linter is happy. Change-Id: I22a13fddaed1338c0f3e670d199bb6aa5f99bbf7 Signed-off-by: Doug Hellmann --- monasca_log_api/app/base/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monasca_log_api/app/base/model.py b/monasca_log_api/app/base/model.py index 2e618ef8..4a24739e 100644 --- a/monasca_log_api/app/base/model.py +++ b/monasca_log_api/app/base/model.py @@ -28,8 +28,8 @@ def serialize_envelope(envelope): json = rest_utils.as_json(envelope, ensure_ascii=False) if six.PY2: - raw = unicode(json.replace(r'\\', r'\\\\'), encoding='utf-8', - errors='replace') + raw = six.text_type(json.replace(r'\\', r'\\\\'), encoding='utf-8', + errors='replace') else: raw = json