Exemple #1
0
def load_person(person, role, childBase):
    person_ = childBase.copy()
    person_.update(person)
    person_['role'] = role
    person_['name'] = '%s %s %s' % (person['title'] or '', person['first_name']
                                    or '', person['last_name'] or '')
    person_['name'] = person_['name'].strip()
    reg_person.upsert(person_, ['representative_etl_id', 'role', 'name'])
def load_person(person, role, childBase):
    person_ = childBase.copy()
    person_.update(person)
    person_['role'] = role
    person_['name'] = '%s %s %s' % (person['title'] or '',
                                    person['first_name'] or '',
                                    person['last_name'] or '')
    person_['name'] = person_['name'].strip()
    reg_person.upsert(person_, ['representative_etl_id', 'role', 'name'])
Exemple #3
0
def save(person):
    orgs = list(reg_representative.find(identification_code=person['org_identification_code']))
    if len(orgs):
        org = max(orgs, key=lambda o: o['last_update_date'])
        person['representative_etl_id'] = org['etl_id']
        person['role'] = 'accredited'
        name = '%s %s %s' % (person['title'] or '',
                             person['first_name'] or '',
                             person['last_name'] or '')
        person['name'] = name.strip()
        log.debug("Accreditation: %s", name)
        reg_person.upsert(person, ['representative_etl_id', 'role', 'name'])
    else:
        log.warn("Cannot associate with a registered interest: %r", person)