Skip to content

Commit

Permalink
move scraped_name set and prepare_obj call to import_legislator
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejs committed Jan 7, 2011
1 parent 9391ab3 commit 2af65d1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions fiftystates/backend/legislators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2af65d1

Please sign in to comment.