def _legislator_objects(self):
        '''A cache of dereferenced legislator objects.
        '''
        kwargs = {}

        id_getter = operator.itemgetter('leg_id')
        ids = []
        for k in ('yes', 'no', 'other'):
            ids.extend(map(id_getter, self[k + '_votes']))
        objs = db.legislators.find({'_all_ids': {'$in': ids}}, **kwargs)

        # Handy to keep a reference to the vote on each legislator.
        objs = list(objs)
        id_cache = {}
        for obj in objs:
            obj.vote = self
            for _id in obj['_all_ids']:
                id_cache[_id] = obj

        return id_cache
def _legislator_objects ( self ) : kwargs = { } id_getter = operator . itemgetter ( 'leg_id' ) ids = [ ] for k in ( 'yes' , 'no' , 'other' ) : ids . extend ( map ( id_getter , self [ k + '_votes' ] ) ) objs = db . legislators . find ( { '_all_ids' : { '$in' : ids } } , ** kwargs ) objs = list ( objs ) id_cache = { } for obj in objs : obj . vote = self for _id in obj [ '_all_ids' ] : id_cache [ _id ] = obj return id_cache
A cache of dereferenced legislator objects.