feed: fix id fallback in Feed._process_entry
authorW. Trevor King <wking@tremily.us>
Tue, 11 Dec 2012 01:07:35 +0000 (20:07 -0500)
committerW. Trevor King <wking@tremily.us>
Tue, 11 Dec 2012 01:07:35 +0000 (20:07 -0500)
The old `entry['id'] or _id` raised a KeyError when the entry lacked
an ID.  The new `entry.get('id', _id)` falls back appropriately.

Signed-off-by: W. Trevor King <wking@tremily.us>
rss2email/feed.py

index 9b129c8953868310be2f47097f287ee37592cd00..3c6513d7b1618c2275bfaf33e390e3d85a30c38a 100644 (file)
@@ -382,7 +382,7 @@ class Feed (object):
         # 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['id'] or id_
+        guid = entry.get('id', id_)
         if isinstance(guid, dict):
             guid = guid.values()[0]
         if guid in self.seen: