commit ca39520c711aabb6ec7e506847c0be557771eddc
parent 79f7410cd3ae71d14715645bd4b728884d79c78e
Author: Christoph Lohmann <20h@r-36.net>
Date: Mon, 22 Jun 2015 18:34:56 +0200
Fix a case where a failed parseiso crashes zeitungsschau.
Diffstat:
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/zeitungsschau/feed.py b/zeitungsschau/feed.py
@@ -141,15 +141,19 @@ def parse(astr):
attrib["file"])
# updated
- if hasattr(entry, "updated"):
- article["updated"] = parseiso(entry.updated,\
- now)
- elif hasattr(entry, "pubDate"):
- article["updated"] = parseiso(entry.pubDate,\
- now)
- elif hasattr(entry, "date"):
- article["updated"] = parseiso(entry.date, now)
- else:
+ try:
+ if hasattr(entry, "updated"):
+ article["updated"] = parseiso(entry.updated,\
+ now)
+ elif hasattr(entry, "pubDate"):
+ article["updated"] = parseiso(entry.pubDate,\
+ now)
+ elif hasattr(entry, "date"):
+ article["updated"] = parseiso(entry.date, now)
+ else:
+ article["updated"] = now
+ except TypeError:
+ # There was some error in parseiso.
article["updated"] = now
# author