From da8fd0964ed7ef222dc8cdcb7d5b92e40b5ca290 Mon Sep 17 00:00:00 2001 From: Ben Adida <ben@adida.net> Date: Sun, 20 Oct 2013 10:34:34 -0700 Subject: [PATCH] improved csv parsing from memory --- helios/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helios/models.py b/helios/models.py index 8e2f762..e421371 100644 --- a/helios/models.py +++ b/helios/models.py @@ -11,7 +11,7 @@ from django.utils import simplejson from django.conf import settings from django.core.mail import send_mail -import datetime, logging, uuid, random, StringIO +import datetime, logging, uuid, random, StringIO, io from crypto import electionalgs, algs, utils from helios import utils as heliosutils @@ -653,7 +653,7 @@ class VoterFile(models.Model): def itervoters(self): if self.voter_file_content: - voter_stream = StringIO.StringIO(self.voter_file_content) + voter_stream = io.StringIO(self.voter_file_content, newline=None) else: voter_stream = open(self.voter_file.path, "rU") @@ -683,7 +683,7 @@ class VoterFile(models.Model): # now we're looking straight at the content if self.voter_file_content: - voter_stream = StringIO.StringIO(self.voter_file_content.encode('utf-8')) + voter_stream = io.StringIO(self.voter_file_content.encode('utf-8'), newline=None) else: voter_stream = open(self.voter_file.path, "rU") -- GitLab