Permalink
Browse files

PA: skip addresses that amount to hot garbage

  • Loading branch information...
1 parent ab59fa1 commit e69f91de2676b02ee26411a147433d7d3797ace4 @twneale twneale committed Jan 3, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 openstates/pa/legislators.py
@@ -161,8 +161,13 @@ def address(self):
lines = lines[::-1]
# Make extra sure "PA 12345" line is last.
- while not re.search('PA \d{5}', lines[-1]):
+ count = 0
+ while not re.search(', PA( \d{5})?', lines[-1]):
lines = lines[-1:] + lines[:-1]
+ count += 1
+ if count > 1000:
+ # If we're here, this address is badly hosed; skip.
+ return
address = '\n'.join(lines)
return address

0 comments on commit e69f91d

Please sign in to comment.