# HG changeset patch # User Dirk Olmes # Date 1279898672 -7200 # Node ID dcee24702dd7fc37beccc42335f9ffe83dfac82f # Parent 254d5b89a6caa0856f3779e81a367b662498909d Adding a feed now logs the exception if one occurred during retrieval. More normalization of feed entries before creating new FeedEntry objects. diff -r 254d5b89a6ca -r dcee24702dd7 AddFeed.py --- a/AddFeed.py Fri Jul 23 04:39:08 2010 +0200 +++ b/AddFeed.py Fri Jul 23 17:24:32 2010 +0200 @@ -2,6 +2,7 @@ from PyQt4 import QtGui from Ui_AddFeed import Ui_AddFeed import FeedUpdater +import logging class AddFeed(QtGui.QDialog): def __init__(self, session): @@ -17,6 +18,8 @@ self.createFeed() self.session.commit() except AttributeError as ae: + logging.getLogger("AddFeed").info(ae) + self.exception = ae self.session.rollback() QtGui.QDialog.accept(self) diff -r 254d5b89a6ca -r dcee24702dd7 FeedUpdater.py --- 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)