From d9a668312c152d4f64318010ec84340015d896bb Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Wed, 17 Feb 2016 00:10:30 +0100 Subject: Import to git --- wikifolio/rss.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 wikifolio/rss.py (limited to 'wikifolio/rss.py') diff --git a/wikifolio/rss.py b/wikifolio/rss.py new file mode 100644 index 0000000..e56c143 --- /dev/null +++ b/wikifolio/rss.py @@ -0,0 +1,30 @@ +import time + +from . import model + +from ll.xist import xsc +from ll.xist.ns import xml, rss20 + + +def dump(cert, comments): + """ + :type cert: model.Certificate + :type comments: list[model.Comment] + """ + title = "Kommentare zu {.name} / {.isin}".format(cert, cert) + items = [] + for comment in comments: + items.append(rss20.item( + rss20.title(title), + rss20.author(comment.author), + rss20.pubDate(time.strftime("%a, %d %b %Y %T %z", + comment.pubDate)), + rss20.guid(comment.guid), + rss20.link(comment.link), + rss20.description(comment.description) + )) + return xsc.Frag(xml.XML(), + rss20.rss(rss20.channel( + rss20.title(title), + *items + ))).string('utf-8') -- cgit v1.2.1