From cf41ae381de9cca5e99e0b0e668cb7299d32ea8e Mon Sep 17 00:00:00 2001 From: Ben Adida <ben@adida.net> Date: Sun, 9 Feb 2014 11:39:14 -0800 Subject: [PATCH] more --- extract-passwords-for-email.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/extract-passwords-for-email.py b/extract-passwords-for-email.py index 6bea406..b7a62b1 100644 --- a/extract-passwords-for-email.py +++ b/extract-passwords-for-email.py @@ -2,16 +2,22 @@ # extract voter_id and passwords for a particular email address # may return many rows, if they all have the same email address # -# python extract-passwords-for-email.py <email_address> +# python extract-passwords-for-email.py <election_uuid> <email_address> # from django.core.management import setup_environ -import settings, sys +import settings, sys, csv +from helios.models import * setup_environ(settings) -email = sys.argv[1] +election_uuid = sys.argv[1] +email = sys.argv[2] + +csv_output = csv.writer(sys.stdout) + +voters = Election.objects.get(uuid=election_uuid).voter_set.filter(voter_email=email) + +for voter in voters: + csv_output.writerow([voter.voter_id, voter.voter_password]) -from helios.models import * -print email -print str(Election.objects.count()) -- GitLab