Don't bail in case of invalid time formats. - zs - Zeitungsschau rss to email converter
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 9e95a0f332a1bfabfba59c9bad6460e70731db9f
(DIR) parent 45fa8f0de67209e4cceeb1df6e3439efe55e7617
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Wed, 11 Nov 2015 18:05:37 +0100
Don't bail in case of invalid time formats.
Diffstat:
zeitungsschau/feed.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/zeitungsschau/feed.py b/zeitungsschau/feed.py
@@ -15,7 +15,12 @@ import pytz
import codecs
def parseiso(dstr, now):
- return dateutil.parser.parse(str(dstr), default=now)
+ try:
+ return dateutil.parser.parse(str(dstr), default=now)
+ except ValueError:
+ # Invalid time format. Could not be parsed.
+ return now
+
def removenamespaces(xml):
for key in xml.nsmap: