retitle 897575 Cannot handle empty ID fields in feed entries
tags 897575 + patch
kthxkby

The problem with the particular site is that they actually have
a bug in their RSS output, meaning that each item has an ID field,
but it's empty. Therefore, when feed.py:_process_entry runs,
entry['id'] is not None, but '', which is a value for what getattr
is concerned, therefore squashing the guid.

The following patch fixes this, although depending on trust_link,
it'll now just store link → link pairs in the seen dictionary, or id
→ id pairs. However, this seems to be what it does for all other
(valid) feeds too, so I guess that's just a design decision (you're
using the dictionary as a set).

--- rss2email-3.9.orig/rss2email/feed.py
+++ rss2email-3.9/rss2email/feed.py
@@ -452,7 +452,8 @@
         # If .trust_guid isn't set, we get back hashes of the content.
         # Instead of letting these run wild, we put them in context
         # by associating them with the actual ID (if it exists).
-        guid = entry.get('id', id_)
+        entry_id = entry.get('id', '')
+        guid = entry_id if len(entry_id) > 0 else id_
         if isinstance(guid, dict):
             guid = guid.values()[0]
         if guid in self.seen:

-- 
 .''`.   martin f. krafft <[email protected]> @martinkrafft
: :'  :  proud Debian developer
`. `'`   http://people.debian.org/~madduck
  `-  Debian - when you have better things to do than fixing systems

Attachment: digital_signature_gpg.asc
Description: Digital GPG signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)

Reply via email to