From e5d2d7eca40897e2e4edbe6a232c64217cc6eb7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 19 Jan 2020 20:04:59 +0100 Subject: [PATCH] misc: replace unicode() calls --- scrutiny/projects/models.py | 3 ++- scrutiny/projects/utils.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scrutiny/projects/models.py b/scrutiny/projects/models.py index e3dcc36..00206b4 100644 --- a/scrutiny/projects/models.py +++ b/scrutiny/projects/models.py @@ -4,6 +4,7 @@ import subprocess from django.conf import settings from django.db import models +from django.utils.encoding import force_text class Project(models.Model): @@ -117,7 +118,7 @@ class Module(models.Model): p = subprocess.Popen(cmd, **kws) stdout = p.communicate()[0] p.wait() - return [x.split(' ', 1) for x in stdout.splitlines()] + return [force_text(x).split(' ', 1) for x in stdout.splitlines()] def get_version_hash(self, version_number): if re.findall(r'\.g([0-9a-f]{7})', version_number): diff --git a/scrutiny/projects/utils.py b/scrutiny/projects/utils.py index 621695f..90f1128 100644 --- a/scrutiny/projects/utils.py +++ b/scrutiny/projects/utils.py @@ -3,6 +3,7 @@ import requests from django.conf import settings from django.core.cache import cache +from django.utils.encoding import force_text CACHE_DURATION = 3600 @@ -100,7 +101,7 @@ def get_issue_deployment_status(issue_id): continue git_log_hashes = [x[0][:7] for x in git_log] for line in git_log: - if not unicode(line[1], 'utf-8', 'ignore').endswith('#%s)' % issue_id): + if not force_text(line[1], 'utf-8', 'ignore').endswith('#%s)' % issue_id): continue commit_hash = line[0][:7] fix_index = git_log_hashes.index(commit_hash)