Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for Atom feeds without a "siteurl" link. #1

Closed
wants to merge 2 commits into from

4 participants

@dokai
Collaborator

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.

@dokai dokai Don't break if a feed does not have an "rel=alternate type=html" link.
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.
1fc6854
@thet
Owner

please add a test and update CHANGES.txt accordingly.

@garbas garbas commented on the diff
plone/app/portlets/portlets/rss.py
@@ -161,8 +161,11 @@ def _retrieveFeed(self):
self._failed = True
return False
self._title = d.feed.title
@garbas Collaborator
garbas added a note

same could be done for d.feed.title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@garbas
Collaborator

i've merged this to master manually

@garbas garbas closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 30, 2011
  1. @dokai

    Don't break if a feed does not have an "rel=alternate type=html" link.

    dokai authored
    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.
Commits on May 21, 2012
  1. @rnd0101
This page is out of date. Refresh to see the latest.
View
2  plone/app/portlets/portlets/rss.pt
@@ -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
@@ -38,6 +39,7 @@
</tal:rss>
<dd class="portletFooter" tal:condition="view/feedAvailable">
<a href=""
+ tal:condition="view/siteurl"
tal:attributes="href view/siteurl"
i18n:translate="box_morelink">
More&hellip;
View
5 plone/app/portlets/portlets/rss.py
@@ -161,8 +161,11 @@ def _retrieveFeed(self):
self._failed = True
return False
self._title = d.feed.title
@garbas Collaborator
garbas added a note

same could be done for d.feed.title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- 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)
Something went wrong with that request. Please try again.