Mercurial > hg > Feedworm
changeset 100:99807963d9e0
use the URL as feed title if the feed itself does not come with a title
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 14 Feb 2011 20:51:03 +0100 |
parents | e59d722439b5 |
children | b2a51c24f209 |
files | FeedUpdater.py |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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