X-Git-Url: https://git.ucc.asn.au/?p=planet-ucc.git;a=blobdiff_plain;f=RSS1Writer.py;h=678f98d1a9f4d7e7462e9208284473a011201632;hp=83460d367ee7f02282a23477554bea72af853c17;hb=52296aaabfab3fd89036e1acca23cd26d2a00173;hpb=7c1189be656d2ab9f484d9d0f1ab1b8f287de4c8 diff --git a/RSS1Writer.py b/RSS1Writer.py index 83460d3..678f98d 100644 --- a/RSS1Writer.py +++ b/RSS1Writer.py @@ -2,12 +2,11 @@ # RSS1Writer # # A plugin to XMLWriter to output RSS version 1.0. -# This plugin has been developed with no regard for the RSS1.0 spec. # # (c) 2004, Davyd Madeley # -import time +import time, cgi class RSS1Writer: def __init__(self, planet): @@ -20,9 +19,9 @@ class RSS1Writer: output += '\n' % item.itemURL output += ' %s: %s\n' % (item.blogTitle, item.itemTitle) output += ' %s\n' % item.itemURL - output += ' \n' - output += item.contents - output += '\n \n' + output += ' \n' + output += cgi.escape(item.contents) + output += '\n \n' output += ' %s\n' % time.strftime('%Y-%m-%dT%H:%M:%S+00:00', time.gmtime(item.itemDate)) output += '\n' return output @@ -31,10 +30,18 @@ class RSS1Writer: itemcount = 0 output = '' output += '\n' + output += ' xmlns="http://purl.org/rss/1.0/"\n' + output += ' xmlns:dc="http://purl.org/dc/elements/1.1/"\n' + output += ' xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n' output += ' \n' output += ' Planet UCC\n' output += ' http://planet.ucc.asn.au/\n' - # XXX: we need to output the blogroll here + output += ' \n' + output += ' \n' + for blog in self.parent.blogs: + output += ' \n' % blog.feedURL + output += ' \n' + output += ' \n' output += ' \n' for date in self.planet: for item in date.items: @@ -44,5 +51,5 @@ class RSS1Writer: break if itemcount >= self.maxitems: break - output += '\n' + output += '' return output