From 708334290272a0bd4c1e17a2cee0e0bf35d14947 Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Thu, 30 Apr 2009 10:26:56 +0200 Subject: Added a document_header function --- blogthon.cgi | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/blogthon.cgi b/blogthon.cgi index f5d68d1..8cdfa5a 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -36,6 +36,22 @@ def errorpage(string): print '' sys.exit() +def document_header(string): + if string == "xhtml-transitional": + print 'Content-type: text/html\n' + print '' + print '' + if string == "xhtml-strict": + print 'Content-type: text/html\n' + print '' + print '' + if string == "atom": + print 'Content-type: application/atom+xml\n' + print '' + print '' + configuration = ConfigParser.ConfigParser() configuration.read('configuration') @@ -142,9 +158,7 @@ if feed_display == "atom": blog_title_md5sum = generate_uuid(blog_title) title_md5sum = generate_uuid(title) - print 'Content-type: application/atom+xml\n' - print '' - print '' + document_header("atom") print '' print ' ' print ' ' + blog_title + '' @@ -163,11 +177,7 @@ if feed_display == "atom": # Generate regular page else: - - print 'Content-type: text/html\n' - print '' - print '' + document_header("xhtml-transitional") print ' ' print ' ' + blog_title + '' print ' ' -- cgit v1.2.3