diff options
author | Stefan Ritter <xeno@thehappy.de> | 2009-06-05 10:56:00 +0200 |
---|---|---|
committer | Stefan Ritter <xeno@thehappy.de> | 2009-06-05 10:56:00 +0200 |
commit | aa2c6ca34766ad395484087f2225135348478c9b (patch) | |
tree | 612c6d4104ae4a8225049385bf84576f1c7269c6 /blogthon.cgi | |
parent | b2faef228be07dcadb0445949d9d912a48db8ff2 (diff) |
First version of RSS feed generation
Diffstat (limited to 'blogthon.cgi')
-rwxr-xr-x | blogthon.cgi | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/blogthon.cgi b/blogthon.cgi index f858554..56d1cf3 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -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") |