Skip to content

Commit

Permalink
Don't break if a feed does not have an "rel=alternate type=html" link.
Browse files Browse the repository at this point in the history
It is possible for a valid Atom feed to omit a

  <link rel="alternate" type="html" href="http://server.com"/>

element which is available through the feedparser object as a

  feed.link

attribute. If the feed does not have this element then the RSS portlet
will throw an AttributeError which will propagate to the page preventing
the original page from rendering.

This changeset adds support for such feeds.
  • Loading branch information
dokai committed Sep 30, 2011
1 parent 4da1117 commit 1fc6854
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions plone/app/portlets/portlets/rss.pt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<span class="portletTopLeft"></span>
<a href=""
tal:attributes="href view/siteurl"
tal:omit-tag="not:view/siteurl"
tal:content="view/title"
class="tile">
Tags
Expand Down
5 changes: 4 additions & 1 deletion plone/app/portlets/portlets/rss.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ def _retrieveFeed(self):
self._failed = True
return False
self._title = d.feed.title
self._siteurl = d.feed.link
self._items = []
try:
self._siteurl = d.feed.link
except AttributeError:
self._siteurl = ""
for item in d['items']:
try:
itemdict = self._buildItemDict(item)
Expand Down

0 comments on commit 1fc6854

Please sign in to comment.