Commit 403cef29 authored by Ivan Tyagov's avatar Ivan Tyagov

Be more forgiving for bad RSS generators.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40158 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7a19289c
......@@ -43,10 +43,10 @@ def getRssDataAsDict(self, url, username=None, password=None):
entry_dict['link'] = entry['link']
entry_dict['other_links'] = [x['href'] for x in entry['links']]
entry_dict['md5'] = md5.new(entry['link']).hexdigest()
entry_dict['content'] = entry['summary']
entry_dict['date'] = entry['updated']
entry_dict['content'] = entry.get('summary', '')
entry_dict['date'] = entry.get('updated', None)
entry_dict['img'] = [x['href'] for x in entry.get('enclosures', [])]
entry_dict['updated_parsed'] = entry['updated_parsed']
entry_dict['updated_parsed'] = entry.get('updated_parsed', None)
result['items'].append(entry_dict)
# sort by date
result['items'] = sorted(result['items'], key=lambda k: k['updated_parsed'])
......
601
\ No newline at end of file
605
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment