# HG changeset patch # User Dirk Olmes # Date 1297713063 -3600 # Node ID 99807963d9e0a9a8d3a4041e5e9bc7091f2ec8fc # Parent e59d722439b527b952974c61e11598183fe90f26 use the URL as feed title if the feed itself does not come with a title diff -r e59d722439b5 -r 99807963d9e0 FeedUpdater.py --- a/FeedUpdater.py Wed Dec 29 04:27:58 2010 +0100 +++ b/FeedUpdater.py Mon Feb 14 20:51:03 2011 +0100 @@ -22,10 +22,13 @@ def createNewFeed(url, session): result = feedparser.parse(url) - title = result["feed"].title + if result.has_key("title"): + title = result["feed"].title + else: + title = url newFeed = Feed(title, url) session.add(newFeed) - + FeedUpdater(session, newFeed).update() def normalize(entry): @@ -45,7 +48,7 @@ def __init__(self, session, feed): self.session = session self.feed = feed - + def update(self): log.info("updating " + self.feed.rss_url) result = self.getFeed() @@ -66,7 +69,7 @@ feedEntry = FeedEntry.findById(entry.id, self.session) if feedEntry is None: self.createFeedEntry(entry) - + def createFeedEntry(self, entry): new = FeedEntry.create(entry) new.feed = self.feed