diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2016-02-17 00:10:30 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2016-02-17 00:10:30 +0100 |
commit | d9a668312c152d4f64318010ec84340015d896bb (patch) | |
tree | be85c9bc2da8d2f286f6ca680fdaa768934805b3 /wikifolio/rss.py | |
download | wikifolio-rss-d9a668312c152d4f64318010ec84340015d896bb.tar.gz wikifolio-rss-d9a668312c152d4f64318010ec84340015d896bb.zip |
Import to git
Diffstat (limited to 'wikifolio/rss.py')
-rw-r--r-- | wikifolio/rss.py | 30 |
1 files changed, 30 insertions, 0 deletions
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') |