diff FeedUpdater.py @ 58:dcee24702dd7

Adding a feed now logs the exception if one occurred during retrieval. More normalization of feed entries before creating new FeedEntry objects.
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 23 Jul 2010 17:24:32 +0200
parents 4b0d686493fb
children abc0516a1c0c
line wrap: on
line diff
--- a/FeedUpdater.py	Fri Jul 23 04:39:08 2010 +0200
+++ b/FeedUpdater.py	Fri Jul 23 17:24:32 2010 +0200
@@ -54,14 +54,20 @@
             
     def normalize(self, entry):
         if not hasattr(entry, "id"):
-            entry.id = entry.link        
+            entry.id = entry.link
+        if not hasattr(entry, "updated_parsed"):
+            entry.updated_parsed = datetime.today()
+        else:
+            entry.updated_parsed = datetime(*entry.updated_parsed[:6])
+        if not hasattr(entry, "summary"):
+            entry.summary = ""
     
     def createFeedEntry(self, entry):
         new = FeedEntry()
         new.id = entry.id
         new.link = entry.link
         new.title = entry.title
-        new.updated = datetime(*entry.updated_parsed[:6])
+        new.updated = entry.updated_parsed
         new.summary = entry.summary
         new.feed = self.feed
         self.session.add(new)