misc: replace unicode() calls

This commit is contained in:
Frédéric Péters 2020-01-19 20:04:59 +01:00
parent bda17fd66a
commit e5d2d7eca4
2 changed files with 4 additions and 2 deletions

View File

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

View File

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