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')) }
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 ]
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')) }
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')) }
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')) }
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")), }
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]
def format_contributors_for_atom(contributors_list): return [ { 'name': html_and_illegal_unicode_replace(entry['name']) } for entry in contributors_list ]
def format_contributors_for_atom(contributors_list): return [{ 'name': html_and_illegal_unicode_replace(entry['name']) } for entry in contributors_list]