예제 #1
0
def to_atom(result):
    if not result['id']['url']:
        logger.error('ATOM error for {}: Missing id'.format(result['source']))
    return {
        'title':
        html_and_illegal_unicode_replace(result.get('title'))
        or 'No title provided.',
        'summary':
        html_and_illegal_unicode_replace(result.get('description'))
        or 'No summary provided.',
        'id':
        result['id']['url'],
        'updated':
        get_date_updated(result),
        'links': [{
            'href': result['id']['url'],
            'rel': 'alternate'
        }],
        'author':
        format_contributors_for_atom(result['contributors']),
        'categories': [{
            "term": html_and_illegal_unicode_replace(tag)
        } for tag in result.get('tags')],
        'published':
        parse(result.get('dateUpdated'))
    }
예제 #2
0
def format_contributors_for_atom(contributors_list):
    return [
        {
            'name': '{} {}'.format(
                html_and_illegal_unicode_replace(entry['given']),
                html_and_illegal_unicode_replace(entry['family'])
            )
        }
        for entry in contributors_list
    ]
예제 #3
0
def to_atom(result):
    return {
        'title': html_and_illegal_unicode_replace(result.get('title')) or 'No title provided.',
        'summary': html_and_illegal_unicode_replace(result.get('description')) or 'No summary provided.',
        'id': result['uris']['canonicalUri'],
        'updated': get_date_updated(result),
        'links': [
            {'href': result['uris']['canonicalUri'], 'rel': 'alternate'}
        ],
        'author': format_contributors_for_atom(result['contributors']),
        'categories': [{'term': html_and_illegal_unicode_replace(tag)} for tag in (result.get('tags', []) + result.get('subjects', []))],
        'published': parse(result.get('providerUpdatedDateTime'))
    }
예제 #4
0
def to_atom(result):
    return {
        'title': html_and_illegal_unicode_replace(result.get('title')) or 'No title provided.',
        'summary': html_and_illegal_unicode_replace(result.get('description')) or 'No summary provided.',
        'id': result['uris']['canonicalUri'],
        'updated': get_date_updated(result),
        'links': [
            {'href': result['uris']['canonicalUri'], 'rel': 'alternate'}
        ],
        'author': format_contributors_for_atom(result['contributors']),
        'categories': [{"term": html_and_illegal_unicode_replace(tag)} for tag in (result.get('tags', []) + result.get('subjects', []))],
        'published': parse(result.get('providerUpdatedDateTime'))
    }
예제 #5
0
def to_atom(result):
    return {
        'title': html_and_illegal_unicode_replace(result.get('title')) or 'No title provided.',
        'summary': html_and_illegal_unicode_replace(result.get('description')) or 'No summary provided.',
        'id': result['id']['url'],
        'updated': get_date_updated(result),
        'links': [
            {'href': result['id']['url'], 'rel': 'alternate'}
        ],
        'author': format_contributors_for_atom(result['contributors']),
        'categories': [{"term": html_and_illegal_unicode_replace(tag)} for tag in result.get('tags')],
        'published': parse(result.get('dateUpdated'))
    }
예제 #6
0
def to_atom(result):
    return {
        "title": html_and_illegal_unicode_replace(result.get("title")) or "No title provided.",
        "summary": html_and_illegal_unicode_replace(result.get("description")) or "No summary provided.",
        "id": result["uris"]["canonicalUri"],
        "updated": get_date_updated(result),
        "links": [{"href": result["uris"]["canonicalUri"], "rel": "alternate"}],
        "author": format_contributors_for_atom(result["contributors"]),
        "categories": [
            {"term": html_and_illegal_unicode_replace(tag)}
            for tag in (result.get("tags", []) + result.get("subjects", []))
        ],
        "published": parse(result.get("providerUpdatedDateTime")),
    }
예제 #7
0
def format_contributors_for_atom(contributors_list):
    return [{
        'name':
        '{} {}'.format(html_and_illegal_unicode_replace(entry['given']),
                       html_and_illegal_unicode_replace(entry['family']))
    } for entry in contributors_list]
예제 #8
0
def format_contributors_for_atom(contributors_list):
    return [
        {
            'name': html_and_illegal_unicode_replace(entry['name'])
        } for entry in contributors_list
    ]
예제 #9
0
def format_contributors_for_atom(contributors_list):
    return [{
        'name': html_and_illegal_unicode_replace(entry['name'])
    } for entry in contributors_list]