Permalink
Browse files

Backing out filter stuff as it is

  • Loading branch information...
Paul Tagliamonte
Paul Tagliamonte committed Aug 24, 2012
1 parent 34d8f65 commit 5b5f6f8d944dd86de82a17392596a3fee6123c6c
Showing with 0 additions and 69 deletions.
  1. +0 −10 billy/importers/bills.py
  2. +0 −49 billy/importers/filters.py
  3. +0 −10 billy/importers/legislators.py
View
@@ -10,7 +10,6 @@
from billy.scrape import JSONDateEncoder
from billy import db
from billy.importers.names import get_legislator_id
-from billy.importers.filters import BillStringsFilter
from billy.importers.subjects import SubjectCategorizer
from billy.importers.utils import (insert_with_id, update, prepare_obj,
next_big_id, oysterize, fix_bill_id,
@@ -26,9 +25,6 @@
import pymongo
-filters = [
- BillStringsFilter()
-]
logger = logging.getLogger('billy')
@@ -396,17 +392,11 @@ def _match_legislator(name):
bill_id = insert_with_id(data)
git_add_bill(data)
- #for f in filters:
- # data = f.filter(data)
-
denormalize_votes(data, bill_id)
return "insert"
else:
git_add_bill(bill)
- #for f in filters:
- # data = f.filter(bill)
-
update(bill, data, db.bills)
denormalize_votes(bill, bill['_id'])
return "update"
View
@@ -1,11 +1,6 @@
import re
-class Filter(object):
- def filter(self, obj):
- pass
-
-
def _phone_formatter(obj, extention):
objs = []
for thing in ["country", "area", "prefix", "line_number"]:
@@ -100,47 +95,3 @@ def single_space_filter(entry):
entry = re.sub("\s+", " ", entry)
return strip_filter(entry)
-
-
-class LegislatorPhoneFilter(Filter):
- def filter(self, obj):
- if "offices" in obj:
- for i in range(0, len(obj['offices'])):
- if "phone" in obj['offices'][i]:
- obj['offices'][i]['phone'] = \
- phone_filter(obj['offices'][i]['phone'])
- return obj
-
-
-class LegislatorEmailFilter(Filter):
- def filter(self, obj):
- if "email" in obj:
- obj['email'] = email_filter(obj['email'])
- return obj
-
-
-class StripFilter(Filter):
- def filter(self, obj):
- if isinstance(obj, basestring):
- return strip_filter(obj)
- elif isinstance(obj, list):
- newl = []
- for x in obj:
- newl.append(self.filter(x))
- return newl
- for x in obj:
- obj[x] = self.filter(obj[x])
- return obj
-
-
-class BillStringsFilter(Filter):
- def filter(self, obj):
- keys = [
- "title",
- "description",
- "summary"
- ]
- for key in keys:
- if key in obj:
- obj[key] = single_space_filter(obj)
- return obj
@@ -8,18 +8,11 @@
from billy import db
from billy.conf import settings
from billy.importers.utils import insert_with_id, update, prepare_obj
-from billy.importers.filters import (LegislatorPhoneFilter,
- LegislatorEmailFilter)
import pymongo
logger = logging.getLogger('billy')
-filters = [
- LegislatorPhoneFilter(),
- LegislatorEmailFilter()
-]
-
def ensure_indexes():
db.legislators.ensure_index('_all_ids', pymongo.ASCENDING)
@@ -198,9 +191,6 @@ def import_legislator(data):
else:
data['old_roles'][leg['roles'][0]['term']] = leg['roles']
- #for flt in filters:
- # data = flt.filter(data)
-
if leg:
update(leg, data, db.legislators)
return "update"

0 comments on commit 5b5f6f8

Please sign in to comment.