comparison FeedUpdater.py @ 101:b2a51c24f209

Provide a better error message if updating a feed fails.
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 15 Feb 2011 03:40:26 +0100
parents 99807963d9e0
children e50d446f9942 e4038dd8cc0e
comparison
equal deleted inserted replaced
100:99807963d9e0 101:b2a51c24f209
56 self.processEntry(entry) 56 self.processEntry(entry)
57 self.feed.incrementNextUpdateDate() 57 self.feed.incrementNextUpdateDate()
58 58
59 def getFeed(self): 59 def getFeed(self):
60 result = feedparser.parse(self.feed.rss_url) 60 result = feedparser.parse(self.feed.rss_url)
61 if result["bozo"] > 0: 61 # bozo flags if a feed is well-formed.
62 raise FeedUpdateException() 62 # if result["bozo"] > 0:
63 if result["status"] >= STATUS_ERROR: 63 # raise FeedUpdateException()
64 raise FeedUpdateException() 64 status = result["status"]
65 if status >= STATUS_ERROR:
66 raise FeedUpdateException("HTTP status " + str(status))
65 return result 67 return result
66 68
67 def processEntry(self, entry): 69 def processEntry(self, entry):
68 normalize(entry) 70 normalize(entry)
69 feedEntry = FeedEntry.findById(entry.id, self.session) 71 feedEntry = FeedEntry.findById(entry.id, self.session)