Skip to content
Snippets Groups Projects
Commit da8fd096 authored by Ben Adida's avatar Ben Adida
Browse files

improved csv parsing from memory

parent 52f76158
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ from django.utils import simplejson ...@@ -11,7 +11,7 @@ from django.utils import simplejson
from django.conf import settings from django.conf import settings
from django.core.mail import send_mail 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 crypto import electionalgs, algs, utils
from helios import utils as heliosutils from helios import utils as heliosutils
...@@ -653,7 +653,7 @@ class VoterFile(models.Model): ...@@ -653,7 +653,7 @@ class VoterFile(models.Model):
def itervoters(self): def itervoters(self):
if self.voter_file_content: if self.voter_file_content:
voter_stream = StringIO.StringIO(self.voter_file_content) voter_stream = io.StringIO(self.voter_file_content, newline=None)
else: else:
voter_stream = open(self.voter_file.path, "rU") voter_stream = open(self.voter_file.path, "rU")
...@@ -683,7 +683,7 @@ class VoterFile(models.Model): ...@@ -683,7 +683,7 @@ class VoterFile(models.Model):
# now we're looking straight at the content # now we're looking straight at the content
if self.voter_file_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: else:
voter_stream = open(self.voter_file.path, "rU") voter_stream = open(self.voter_file.path, "rU")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment