In case there is no pubdate, don't add it to the uuid. - zs - Zeitungsschau rss to email converter (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- (DIR) commit a8d6277ef2b6adfd085a13ac1d01bd0a054a47a7 (DIR) parent bea5daebe99ff92fffec41f86332fc3b3621162e (HTM) Author: Christoph Lohmann <20h@r-36.net> Date: Tue, 29 Apr 2014 18:33:48 +0200 In case there is no pubdate, don't add it to the uuid. Diffstat: feed.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- (DIR) diff --git a/feed.py b/feed.py @@ -45,6 +45,7 @@ def parse(astr): articles = [] isrss = False isrdf = False + now = datetime.now() if hasattr(xml, "channel"): if hasattr(xml, "item"): @@ -69,7 +70,7 @@ def parse(astr): elif hasattr(xml, "lastBuildDate"): feed["updated"] = parseiso(xml.lastBuildDate) else: - feed["updated"] = datetime.now() + feed["updated"] = now if hasattr(xml, "link"): if "href" in xml.link.attrib: @@ -145,7 +146,7 @@ def parse(astr): elif hasattr(entry, "date"): article["updated"] = parseiso(entry.date) else: - article["updated"] = datetime.now() + article["updated"] = now # author if hasattr(entry, "author"): @@ -183,7 +184,10 @@ def parse(astr): else: article["id"] = article["text"][:30] - article["uuid"] = "%s" % (article["updated"]) + if article["updated"] == now: + article["uuid"] = "" + else: + article["uuid"] = "%s" % (article["updated"]) for e in ("id", "title", "file"): if e in article: article["uuid"] = "%s-%s" % \