diff --git a/helios/models.py b/helios/models.py index 8e2f7622d9d3e428b122091231280be1513d3f28..e4213715c382eb8a97e78081c3dc1a738ff67c38 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")