Mercurial > hg > Feedworm
comparison FeedUpdater.py @ 50:4b0d686493fb
better error handling while adding feeds: data is only saved if a feed could be created and entries could be retrieved. MainWindow displays feedback in the status bar if an exception occurred while adding a feed.
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 17 May 2010 04:30:55 +0200 |
parents | 0604e374c1d6 |
children | dcee24702dd7 |
comparison
equal
deleted
inserted
replaced
49:6eba4168fd54 | 50:4b0d686493fb |
---|---|
23 def createNewFeed(url, session): | 23 def createNewFeed(url, session): |
24 result = feedparser.parse(url) | 24 result = feedparser.parse(url) |
25 title = result["feed"].title | 25 title = result["feed"].title |
26 newFeed = Feed(title, url) | 26 newFeed = Feed(title, url) |
27 session.add(newFeed) | 27 session.add(newFeed) |
28 session.commit() | |
29 | 28 |
30 FeedUpdater(session, newFeed).update() | 29 FeedUpdater(session, newFeed).update() |
31 session.commit() | |
32 | 30 |
33 class FeedUpdater(object): | 31 class FeedUpdater(object): |
34 def __init__(self, session, feed): | 32 def __init__(self, session, feed): |
35 self.session = session | 33 self.session = session |
36 self.feed = feed | 34 self.feed = feed |