Commit dade8d98 authored by Jérome Perrin's avatar Jérome Perrin

Minimal fixes for xhtml front page RSS reader gadget

This makes RSS reader somehow usable for support request RSS.

One important think to keep in mind is that because of a bug in how URL characters are (not) escaped in the dialog to edit character is that editing the feed URL should be edited from knowledge pad module, and not directly from front page. Also this should be edited by clicking Edit button, not by pressing enter.

See merge request nexedi/erp5!1467
parents 4a4fcfc4 623d7748
...@@ -3,7 +3,6 @@ from hashlib import md5 ...@@ -3,7 +3,6 @@ from hashlib import md5
def getRssDataAsDict(context, url, username=None, password=None): def getRssDataAsDict(context, url, username=None, password=None):
result = {} result = {}
translate = context.Base_translateString
# no url, no feed to read # no url, no feed to read
if url in ('', None, 'None',): if url in ('', None, 'None',):
# no URL # no URL
...@@ -49,9 +48,10 @@ def getRssDataAsDict(context, url, username=None, password=None): ...@@ -49,9 +48,10 @@ def getRssDataAsDict(context, url, username=None, password=None):
for entry in d.entries: for entry in d.entries:
entry_dict = {} entry_dict = {}
entry_dict['title'] = entry['title'] entry_dict['title'] = entry['title']
entry_dict['author'] = entry.get('author', '')
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', [])]
......
...@@ -45,9 +45,7 @@ ...@@ -45,9 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 6, 2: local variable \'translate\' is assigned to but never used</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -54,6 +54,7 @@ for result in items: ...@@ -54,6 +54,7 @@ for result in items:
message = newTempBase(context, 'item') message = newTempBase(context, 'item')
message.edit(field_title = result.get('title','No title'), message.edit(field_title = result.get('title','No title'),
field_date = date, field_date = date,
field_author = result['author'],
field_content = result.get('content','No content'), field_content = result.get('content','No content'),
field_img = result.get('img',''), field_img = result.get('img',''),
field_others_links = result.get('other_links',''), field_others_links = result.get('other_links',''),
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</item> </item>
<item> <item>
<key> <string>enctype</string> </key> <key> <string>enctype</string> </key>
<value> <string></string> </value> <value> <string>multipart/form-data</string> </value>
</item> </item>
<item> <item>
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
......
<tal:block <tal:block
tal:define="title here/field_title; tal:define="title here/field_title;
author here/field_author;
date here/field_date|nothing; date here/field_date|nothing;
description here/field_content; description here/field_content;
image here/field_img; image here/field_img;
...@@ -40,7 +41,9 @@ ...@@ -40,7 +41,9 @@
<span class="document-title" <span class="document-title"
tal:content="title"/> - tal:content="title"/> -
<span class="modification-date" <span class="modification-date"
tal:content="date"/> tal:content="date"/> -
<span class="modification-date"
tal:content="author"/>
</a> </a>
</div> </div>
...@@ -60,7 +63,10 @@ ...@@ -60,7 +63,10 @@
<span class="document-title" <span class="document-title"
tal:content="title"/> - tal:content="title"/> -
<span class="modification-date" <span class="modification-date"
tal:content="date"/> tal:content="date"/> -
<span class="modification-date"
tal:content="author"/>
</div> </div>
<!-- Hidden description --> <!-- Hidden description -->
......
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