+#
+# RSS1Writer
+#
+# A plugin to XMLWriter to output RSS version 1.0.
+# This plugin has been developed with no regard for the RSS1.0 spec.
+#
+#
+
+import time
+
+class RSS1Writer:
+ def __init__(self, planet):
+ self.planet = planet
+ self.maxitems = 50
+ self.parent = None
+
+ def __write_item__(self, item):
+ output = ''
+ output += '<item rdfAbout="%s">\n' % item.itemURL
+ output += ' <title>%s: %s</title>\n' % (item.blogTitle, item.itemTitle)
+ output += ' <link>%s</link>\n' % item.itemURL
+ output += ' <content:encoded>\n'
+ output += item.contents
+ output += '\n </content:encoded>\n'
+ output += ' <dc:date>%s</dc:date>\n' % time.strftime('%Y-%m-%dT%H:%M:%S+00:00', time.gmtime(item.itemDate))
+ output += '</item>\n'
+ return output
+
+ def write(self):
+ itemcount = 0
+ output = ''
+ output += '<rdf:RDF>\n'
+ output += ' <channel>\n'
+ output += ' <title>Planet UCC</title>\n'
+ output += ' <link>http://planet.ucc.asn.au/</link>\n'
+ # XXX: we need to output the blogroll here
+ output += ' </channel>\n'
+ for date in self.planet:
+ for item in date.items:
+ output += self.__write_item__(item)
+ itemcount += 1
+ if itemcount >= self.maxitems:
+ break
+ if itemcount >= self.maxitems:
+ break
+ output += '</rdf:RDF>\n'
+ return output