def make_fingerprint(engine, person):
    try:
        long_name = make_long_name(person)
        try:
            long_name = resolve_person(long_name)
            log.info(" -> %s" % long_name.strip())
        except:
            log.error("Resolve did not work")
            pass

        Person = sl.get_table(engine, 'person')
        sl.upsert(engine, Person, {
            'fingerprint': long_name,
            'slug': url_slug(long_name),
            'mdb_id': person['mdb_id']
            }, unique=['mdb_id'])
        Rolle = sl.get_table(engine, 'rolle')
        sl.upsert(engine, Rolle, {
            'mdb_id': person['mdb_id'],
            'fingerprint': long_name
            }, unique=['mdb_id'])
        person['fingerprint'] = long_name
    except BadReference:
        log.error("Bad Reference %s", person)
        pass
def make_person(engine, beitrag, fp, source_url):
    try:
        fp = resolve_person(fp)
        person = {
            'fingerprint': fp,
            'slug': url_slug(fp),
            'source_url': source_url,
            'vorname': beitrag['vorname'],
            'nachname': beitrag['nachname'],
            'ort': beitrag.get('ort'),
            'ressort': beitrag.get('ressort'),
            'land': beitrag.get('land'),
            'fraktion': beitrag.get('fraktion')
        }
        sl.upsert(engine, sl.get_table(engine, 'person'), person,
                  unique=['fingerprint'])
    except BadReference: pass
    return fp
def make_person(engine, beitrag, fp, source_url):
    try:
        fp = resolve_person(fp)
        person = {
            'fingerprint': fp,
            'slug': url_slug(fp),
            'source_url': source_url,
            'vorname': beitrag['vorname'],
            'nachname': beitrag['nachname'],
            'ort': beitrag.get('ort'),
            'ressort': beitrag.get('ressort'),
            'land': beitrag.get('land'),
            'fraktion': beitrag.get('fraktion')
        }
        sl.upsert(engine,
                  sl.get_table(engine, 'person'),
                  person,
                  unique=['fingerprint'])
    except BadReference:
        pass
    return fp