summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2019-09-18 17:34:49 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2019-09-18 17:34:49 (GMT)
commit96dcd6f964b14c20075e169df0a49f73b80e7191 (patch)
treeb3abaa2c85fd698907199b660eec99eb87d5e089
parente7668b482d1a23f8be39b4fccb74aa9aec95b81c (diff)
downloadpublik-client-scripts-96dcd6f964b14c20075e169df0a49f73b80e7191.zip
publik-client-scripts-96dcd6f964b14c20075e169df0a49f73b80e7191.tar.gz
publik-client-scripts-96dcd6f964b14c20075e169df0a49f73b80e7191.tar.bz2
orleans: update script for Python 3 (#36235)v1.11
-rw-r--r--clients/orleans/sync-creche-events.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/clients/orleans/sync-creche-events.py b/clients/orleans/sync-creche-events.py
index 91c0f27..032ef84 100644
--- a/clients/orleans/sync-creche-events.py
+++ b/clients/orleans/sync-creche-events.py
@@ -1,5 +1,6 @@
import csv
import datetime
+import io
import os
import zipfile
import sys
@@ -18,14 +19,14 @@ FILE_PATH = sys.argv[1]
FILE_ENCODING = 'ISO-8859-1'
with zipfile.ZipFile(FILE_PATH) as data:
- csv_fd = data.open('extract_prcit_planning_creche.csv')
+ csv_fd = io.TextIOWrapper(data.open('extract_prcit_planning_creche.csv'), encoding=FILE_ENCODING)
reader = csv.reader(csv_fd, delimiter=';')
# skip header line
- reader.next()
+ next(reader)
with transaction.atomic():
for row in reader:
- agenda_name = u'%s - %s' % (row[10].decode(FILE_ENCODING), row[11].decode(FILE_ENCODING))
+ agenda_name = u'%s - %s' % (row[10], row[11])
agenda, created = Agenda.objects.get_or_create(label=agenda_name)
event_start_dt = '%s %s' % (row[1], row[2])
# delete all old events