Ejemplo n.º 1
0
 def make_ref(self, card, score, url, citation):
     data = {
         'citation': citation,
         'url': url,
         'source': 'OpenCorporates',
         'score': score,
         'source_url': 'https://opencorporates.com'
     }
     ref = Reference.find(card, data.get('url'))
     if ref is None:
         ref = Reference()
     ref.save(data, card, User.default_user())
Ejemplo n.º 2
0
 def make_ref(self, card, id, score, type_, record, idx):
     label = record.get('Citation', record.get('title', record.get('Name')))
     if len(label) > 80:
         label = label[:80] + '...'
     data = {
         'citation': '%s: %s' % (type_, label),
         'url': URL + 'homes/tree/%s#match%s' % (id, idx),
         'source': 'OpenDuka',
         'score': score,
         'source_url': 'http://openduka.org'
     }
     ref = Reference.find(card, data.get('url'))
     if ref is None:
         ref = Reference()
     ref.save(data, card, User.default_user())
Ejemplo n.º 3
0
 def make_ref(self, card, id, score, type_, record, idx):
     label = record.get('Citation',
                        record.get('title',
                                   record.get('Name')))
     if len(label) > 80:
         label = label[:80] + '...'
     data = {
         'citation': '%s: %s' % (type_, label),
         'url': URL + 'homes/tree/%s#match%s' % (id, idx),
         'source': 'OpenDuka',
         'score': score,
         'source_url': 'http://openduka.org'
     }
     ref = Reference.find(card, data.get('url'))
     if ref is None:
         ref = Reference()
     ref.save(data, card, User.default_user())
Ejemplo n.º 4
0
def extract_multi(parent):
    seen = set([parent.id])
    for offset, card in extract_known(parent):
        if card.id not in seen:
            seen.add(card.id)
            yield offset, card

    for offset, data in extract_calais(parent.text):
        author = User.default_user()
        card = Card.find(data.get('title'))
        if card is None:
            card = Card()
        elif card.id in seen:
            continue
        else:
            data['text'] = card.text
            author = card.author
        card.save(data, author)
        seen.add(card.id)
        yield offset, card