Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Commit

Permalink
use argparse to denote required filename
Browse files Browse the repository at this point in the history
  • Loading branch information
alee committed Oct 31, 2016
1 parent a102a16 commit 81b0efa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions vcweb/core/management/commands/filtersubjectpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@ class Command(BaseCommand):
generates an output.txt file suitable for import into ASU's AMDF facility'''
args = '<csv-file-with-emails-and-asurite-ids-to-process>'

def handle(self, emails, *args, **options):
with open(emails, 'rb') as infile, open('spool-amdf.txt', 'wb') as outfile, open('spool-dupes.txt', 'wb') as dupes:
def add_arguments(self, parser):
parser.add_argument('filename',
help='CSV file with "First Name, Last Name, ASU Email, Regular Email, ASURITE ID" header"',
default='freshman.csv',
)

def handle(self, *args, **options):
input_filename = options['filename']
with open(input_filename, 'rb') as infile, open('spool-amdf.txt', 'wb') as outfile, open('spool-dupes.txt', 'wb') as dupes:
r = csv.reader(infile)
header = next(r, None)
# FIXME: make this more broadly generalizable if needed
Expand Down

0 comments on commit 81b0efa

Please sign in to comment.