First version of RSS feed generation

This commit is contained in:
Stefan Ritter 2009-06-05 10:56:00 +02:00
parent b2faef228b
commit aa2c6ca347

View File

@ -61,6 +61,10 @@ def document_header(string):
print 'Content-type: application/atom+xml\n'
print '<?xml version="1.0" encoding="utf-8"?>'
print '<feed xmlns="http://www.w3.org/2005/Atom">'
if string == "rss":
print 'Content-type: application/rss+xml\n'
print '<?xml version="1.0" encoding="utf-8"?>'
print '<rss version="2.0">'
configuration = ConfigParser.ConfigParser()
configuration.read('configuration')
@ -222,6 +226,27 @@ if feed_display == "atom":
print ' </entry>'
print '</feed>'
# Generate rss 2.0 feed
if feed_display == "rss":
title = str(entries[0][1]).replace('entries/', '', 1).replace('.' + entries_suffix, '')
date = entries[0][0]
blog_title_md5sum = generate_uuid(blog_title)
title_md5sum = generate_uuid(title)
document_header("rss")
print ' <channel>'
print ' <title>' + blog_title + '</title>'
print ' <link>' + blog_url + '</link>'
print ' <description>' + blog_subtitle + '</description>'
print ' <pubDate>' + date + '<pubDate>'
print ''
print ' <item>'
print ' <title>' + title + '</title>'
print ' <link>' + blog_url + '</link>'
print ' </item>'
print ' </channel>'
print '</rss>'
# Generate regular page
else:
document_header("xhtml-transitional")