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

added some fixes for weird newlines in csv uploads

parent 50c63e84
Branches
Tags
No related merge requests found
......@@ -673,6 +673,12 @@ class VoterFile(models.Model):
else:
content = self.voter_file_content
# now we have to handle non-universal-newline stuff
# we do this in a simple way: replace all \r with \n
# then, replace all double \n with single \n
# this should leave us with only \n
content = content.replace('\r','\n').replace('\n\n','\n')
voter_stream = io.BytesIO(content)
else:
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