Mercurial > hg > Feedworm
diff FeedUpdater.py @ 27:bdd1296a4b8c
implemented adding a feed
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Thu, 29 Apr 2010 06:47:47 +0200 |
parents | e87c54b3a216 |
children | 72dfae865899 |
line wrap: on
line diff
--- a/FeedUpdater.py Thu Apr 29 06:47:22 2010 +0200 +++ b/FeedUpdater.py Thu Apr 29 06:47:47 2010 +0200 @@ -17,6 +17,15 @@ logger.warn("problems while updating feed " + feed.rss_url) session.commit() +def createNewFeed(url, session): + result = feedparser.parse(url) + title = result["feed"].title + newFeed = Feed(title, url) + session.add(newFeed) + session.commit() + FeedUpdater(newFeed).update() + session.commit() + class FeedUpdater(object): def __init__(self, session, feed): self.session = session