#39 — Update breaks on some feeds

State Resolved
Version: 2.0.5
Area Functionality
Issue type Bug
Severity Medium
Submitted by Domen Kožar
Submitted on Oct 02, 2011
Responsible Maurits van Rees
Target release: 2.0.6
Following feed causes trouble: http://slovenski-prevajalci.blogspot.com/[…]/default


2011-10-02 12:12:27 ERROR Zope.SiteErrorLog 1317550347.730.240197045982
Traceback (innermost last):
  Module ZPublisher.Publish, line 126, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 46, in call_object
  Module Products.feedfeeder.browser.feed, line 46, in __call__
  Module Products.feedfeeder.browser.feed, line 43, in update
  Module Products.feedfeeder.utilities, line 98, in retrieveFeedItems
  Module Products.feedfeeder.utilities, line 295, in _retrieveSingleFeed
  Module Products.feedfeeder.utilities, line 346, in updateWithRemoteFile
  Module feedparser, line 356, in __getattr__
AttributeError: object has no attribute 'type'

One of the link does not have link type information, I would suggest to fallback to "unknown" or something similar in that case
Added by Maurits van Rees on Oct 02, 2011 11:02 AM
Issue state: UnconfirmedConfirmed
Responsible manager: (UNASSIGNED)maurits
I have just tried it on trunk with that feed and it works fine here. But I do not even get to the point where link.type is getting called (line 346 in utilities.py).

We can still guard against this error though. I would commit the following fix, but svn.plone.org is currently down::

  $ svn diff
  Index: Products/feedfeeder/utilities.py
  --- Products/feedfeeder/utilities.py (revision 244438)
  +++ Products/feedfeeder/utilities.py (working copy)
  @@ -343,7 +343,13 @@
  - obj.update_data(file, link.type)
  + try:
  + link_type = link.type
  + except AttributeError:
  + # Some links do not have a type.
  + # http://plone.org/products/feedfeeder/issues/39
  + link_type = 'application/octet-stream'
  + obj.update_data(file, link_type)
       except urllib2.URLError:
           # well, if we cannot retrieve the data, the file object will
Added by Domen Kožar on Oct 02, 2011 11:53 AM
Interesting, as I am using trunk version. Maybe it's not getting enough entries.

The patch also needs to affect isHTMLEnclosure method, otherwise it looks good to me.
Added by Maurits van Rees on Oct 03, 2011 09:33 AM
Issue state: ConfirmedResolved
Patched both location on trunk in r244981.
Added by Maurits van Rees on Oct 03, 2011 09:40 AM
Target release: None2.0.6
Released 2.0.6 with this fix.

No responses can be added.