Atom need a 2byte string for month and date, but date[] returns a 1byte string
for month and date < 10.
This commit is contained in:
Stefan Ritter 2009-04-30 13:40:39 +02:00
parent 7083342902
commit 6811796ff4
1 changed files with 8 additions and 2 deletions

View File

@ -158,6 +158,12 @@ if feed_display == "atom":
blog_title_md5sum = generate_uuid(blog_title) blog_title_md5sum = generate_uuid(blog_title)
title_md5sum = generate_uuid(title) title_md5sum = generate_uuid(title)
# Atom need a 2byte string
month = str(date[1])
day = str(date[2])
if len(str(date[1])) == 1: month = '0' + str(date[1])
if len(str(date[2])) == 1: day = '0' + str(date[2])
document_header("atom") document_header("atom")
print '<link href="' + blog_url + '/?feed=atom" rel="self" type="application/atom+xml"/>' print '<link href="' + blog_url + '/?feed=atom" rel="self" type="application/atom+xml"/>'
print ' <author>' print ' <author>'
@ -165,13 +171,13 @@ if feed_display == "atom":
print ' </author>' print ' </author>'
print ' <title>' + blog_title + '</title>' print ' <title>' + blog_title + '</title>'
print ' <id>urn:uuid:' + blog_title_md5sum + '</id>' print ' <id>urn:uuid:' + blog_title_md5sum + '</id>'
print ' <updated>' + str(date[0]) + '-0' + str(date[1]) + '-' + str(date[2]) + 'T' + str(date[3]) + ':' + str(date[4]) + ':' + str(date[5]) + 'Z</updated>' print ' <updated>' + str(date[0]) + '-' + month + '-' + day + 'T' + str(date[3]) + ':' + str(date[4]) + ':' + str(date[5]) + 'Z</updated>'
print '' print ''
print ' <entry>' print ' <entry>'
print ' <title>' + title + '</title>' print ' <title>' + title + '</title>'
print ' <link href="' + blog_url + '"/>' print ' <link href="' + blog_url + '"/>'
print ' <id>urn:uuid:' + title_md5sum + '</id>' print ' <id>urn:uuid:' + title_md5sum + '</id>'
print ' <updated>' + str(date[0]) + '-0' + str(date[1]) + '-' + str(date[2]) + 'T' + str(date[3]) + ':' + str(date[4]) + ':' + str(date[5]) + 'Z</updated>' print ' <updated>' + str(date[0]) + '-' + month + '-' + day + 'T' + str(date[3]) + ':' + str(date[4]) + ':' + str(date[5]) + 'Z</updated>'
print ' </entry>' print ' </entry>'
print '</feed>' print '</feed>'