Commit 1a0a1595 authored by Jérome Perrin's avatar Jérome Perrin

knowledge_pad: use a better key for messages

To "mark as read" and open preview, the front page gadget uses the "md5" key,
which is calculated from "link", but we can have multiple entries for the same
links, like it's the case for officejs_support_request app.

Instead, use guid or id if available, this is what RSS/atom use for this purpose.
parent 653ab8ae
...@@ -50,7 +50,7 @@ def getRssDataAsDict(context, url, username=None, password=None): ...@@ -50,7 +50,7 @@ def getRssDataAsDict(context, url, username=None, password=None):
entry_dict['title'] = entry['title'] entry_dict['title'] = entry['title']
entry_dict['link'] = entry['link'] entry_dict['link'] = entry['link']
entry_dict['other_links'] = [x['href'] for x in entry['links']] entry_dict['other_links'] = [x['href'] for x in entry['links']]
entry_dict['md5'] = md5(entry['link']).hexdigest() entry_dict['md5'] = md5((entry.get('guid') or entry.get('id') or entry['link']).encode()).hexdigest()
entry_dict['content'] = entry.get('summary', '') entry_dict['content'] = entry.get('summary', '')
entry_dict['date'] = entry.get('updated', None) entry_dict['date'] = entry.get('updated', None)
entry_dict['img'] = [x['href'] for x in entry.get('enclosures', [])] entry_dict['img'] = [x['href'] for x in entry.get('enclosures', [])]
......
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