From 2af65d14349c5bb2cfa82a6ad688b8d25d96341e Mon Sep 17 00:00:00 2001 From: Michael Stephens Date: Fri, 7 Jan 2011 14:06:43 -0500 Subject: [PATCH] move scraped_name set and prepare_obj call to import_legislator --- fiftystates/backend/legislators.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fiftystates/backend/legislators.py b/fiftystates/backend/legislators.py index 0d875999cb..4edeb0bd26 100644 --- a/fiftystates/backend/legislators.py +++ b/fiftystates/backend/legislators.py @@ -37,11 +37,7 @@ def import_legislators(state, data_dir): paths = glob.glob(pattern) for path in paths: with open(path) as f: - data = prepare_obj(json.load(f)) - - data['_scraped_name'] = data['full_name'] - - import_legislator(data) + import_legislator(json.load(data)) print 'imported %s legislator files' % len(paths) @@ -119,6 +115,9 @@ def get_next_term(state, term): def import_legislator(data): + data = prepare_obj(data) + data['_scraped_name'] = data['full_name'] + # Rename 'role' -> 'type' for role in data['roles']: if 'role' in role: