comparison FeedUpdater.py @ 10:01a86b178e60

catch the FeedUpdateException that might be raised when updating a feed, print it and continue with next feed
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 27 Apr 2010 20:08:21 +0200
parents fd4c8bfa62d6
children e87c54b3a216
comparison
equal deleted inserted replaced
9:fd4c8bfa62d6 10:01a86b178e60
7 STATUS_OK = 200 7 STATUS_OK = 200
8 8
9 def updateAllFeeds(session): 9 def updateAllFeeds(session):
10 allFeeds = session.query(Feed) 10 allFeeds = session.query(Feed)
11 for feed in allFeeds: 11 for feed in allFeeds:
12 FeedUpdater(session, feed).update() 12 try:
13 FeedUpdater(session, feed).update()
14 except FeedUpdateException:
15 print("problems while updating feed " + feed.rss_url)
13 session.commit() 16 session.commit()
14 17
15 class FeedUpdater(object): 18 class FeedUpdater(object):
16 def __init__(self, session, feed): 19 def __init__(self, session, feed):
17 self.session = session 20 self.session = session