zs

Zeitungsschau rss to email converter
git clone git://r-36.net/zs
Log | Files | Refs | LICENSE

commit a27ba4bf6d84464ebafcc9a4306ab829852a2cbf
parent c1d3567569feb6b1cbb4513fa52c10839e1a9598
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sat, 13 Dec 2014 08:17:16 +0100

Add default value for datetime.

Diffstat:
TODO.md | 5+++++
zeitungsschau/feed.py | 10+++++-----
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -3,3 +3,8 @@ * attach diff of identical articles * useful with news changing over time +# BUGS + +* send all debug information, if subject is null +* fix backslash escaping in e-mail texts + diff --git a/zeitungsschau/feed.py b/zeitungsschau/feed.py @@ -12,8 +12,8 @@ import dateutil.parser import urllib.request, urllib.parse, urllib.error import hashlib -def parseiso(dstr): - return dateutil.parser.parse(str(dstr)) +def parseiso(dstr, now): + return dateutil.parser.parse(str(dstr), default=now) def removenamespaces(xml): for key in xml.nsmap: @@ -65,11 +65,11 @@ def parse(astr): feed["title"] = str(xml.image.title) if hasattr(xml, "updated"): - feed["updated"] = parseiso(xml.updated) + feed["updated"] = parseiso(xml.updated, now) elif hasattr(xml, "pubDate"): - feed["updated"] = parseiso(xml.pubDate) + feed["updated"] = parseiso(xml.pubDate, now) elif hasattr(xml, "lastBuildDate"): - feed["updated"] = parseiso(xml.lastBuildDate) + feed["updated"] = parseiso(xml.lastBuildDate, now) else: feed["updated"] = now