Mercurial > hg > Feedworm
changeset 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 | 254d5b89a6ca |
children | daa2731967fe |
files | AddFeed.py FeedUpdater.py |
diffstat | 2 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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)