news4 - RSS aggrigation system
Revision | 32bf686b742747550815da3f22823db8d90a2fb1 (tree) |
---|---|
Time | 2012-12-04 13:23:06 |
Author | hylom <hylom@user...> |
Commiter | hylom |
temporary fix: error ocurred when RSS's description is not exist
@@ -18,11 +18,15 @@ class FeedFetcher(object): | ||
18 | 18 | f = feedparser.parse(self._feed["source"]) |
19 | 19 | entries = [] |
20 | 20 | for e in f['entries']: |
21 | + try: | |
22 | + desc = e.description | |
23 | + except AttributeError: | |
24 | + desc = '' | |
21 | 25 | entry = { |
22 | 26 | # 'title': e.title.decode('utf8') if isinstance(e.title, str) else e.title, |
23 | 27 | 'title': e.title, |
24 | 28 | 'url': e.link, |
25 | - 'body': e.description, | |
29 | + 'body': desc, | |
26 | 30 | 'date': dateutil.parser.parse(e.updated), |
27 | 31 | 'feed': self._feed, |
28 | 32 | 'tags': [], |