diff --git a/zoo/zoo_nanterre/views.py b/zoo/zoo_nanterre/views.py index 0d562e9..4ac02b5 100644 --- a/zoo/zoo_nanterre/views.py +++ b/zoo/zoo_nanterre/views.py @@ -17,6 +17,7 @@ # along with this program. If not, see . import csv +import io import itertools import time @@ -28,7 +29,7 @@ from django.db.transaction import non_atomic_requests, atomic from django.db import connection from django.conf import settings from django.core.cache import cache -from django.utils.timezone import now +from django.utils.timezone import now, six from django.contrib.auth.decorators import permission_required from django.contrib import messages @@ -114,7 +115,10 @@ def synchronize_federations_report(request, job_id, model_admin, *args, **kwargs report = job.action.report if not report: raise Http404('no report') - reader = csv.reader(report) + text_report = report + if six.PY3: + text_report = io.TextIOWrapper(text_report, encoding='utf-8') + reader = csv.reader(text_report) next(reader) actions = [row for row in reader if row[6] != 'KEEP'] context = dict( @@ -145,7 +149,10 @@ def synchronize_federations_apply_report(request, job_id, model_admin, *args, ** report = job.action.apply_report if not report: raise Http404('no report') - reader = csv.reader(report) + text_report = report + if six.PY3: + text_report = io.TextIOWrapper(text_report, encoding='utf-8') + reader = csv.reader(text_report) next(reader) actions = [row for row in reader if row[6] != 'KEEP'] context = dict(