compliancy fixes
[planet-ucc.git] / RSS1Writer.py
index 638047e..678f98d 100644 (file)
@@ -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 <[email protected]>
 #
 
-import time
+import time, cgi
 
 class RSS1Writer:
        def __init__(self, planet):
@@ -20,9 +19,9 @@ class RSS1Writer:
                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  +=      ' <description>\n'
+               output  +=      cgi.escape(item.contents)
+               output  +=      '\n </description>\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
@@ -30,9 +29,9 @@ class RSS1Writer:
        def write(self):
                itemcount       = 0
                output  =       ''
-               output  +=      '<rdf:RDF\n'
+               output  +=      '<rdf:RDF>\n'
+               output  +=      ' xmlns="http://purl.org/rss/1.0/"\n'
                output  +=      ' xmlns:dc="http://purl.org/dc/elements/1.1/"\n'
-               output  +=      ' xmlns:content="http://purl.org/rss/1.0/modules/content/">\n'
                output  +=      ' xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n'
                output  +=      ' <channel>\n'
                output  +=      '  <title>Planet UCC</title>\n'
@@ -42,7 +41,7 @@ class RSS1Writer:
                for blog in self.parent.blogs:
                        output  +=      '    <rdf:li rdf:resource="%s" />\n' % blog.feedURL
                output  +=      '   </rdf:Seq>\n'
-               output  +=      '  <items>\n'
+               output  +=      '  </items>\n'
                output  +=      ' </channel>\n'
                for date in self.planet:
                        for item in date.items:
@@ -52,5 +51,5 @@ class RSS1Writer:
                                        break
                        if itemcount >= self.maxitems:
                                break
-               output  +=      '</rdf:RDF>\n'
+               output  +=      '</rdf:RDF>'
                return output

UCC git Repository :: git.ucc.asn.au