make atom file timestamp = current time

This commit is contained in:
Colin McMillen 2021-07-01 19:22:02 -04:00
parent 8b0570438c
commit 95fb136689

View File

@ -14,6 +14,7 @@
import argparse
from bs4 import BeautifulSoup
import datetime
import glob
import html
from io import StringIO
@ -169,11 +170,9 @@ def make_atom_feed():
blog_entries.sort(key=operator.itemgetter('date'))
entries_io = StringIO()
last_update = None
for entry in blog_entries:
# We lie and pretend that all entries were written at noon EST.
update_date = entry['date'] + 'T12:00:00-04:00'
last_update = update_date
entries_io.write(entry_template.format(
url=entry['url'],
title=entry['title'],
@ -183,6 +182,8 @@ def make_atom_feed():
entries_text = entries_io.getvalue()
now = datetime.datetime.now()
last_update = datetime.datetime.isoformat(now, 'T', 'seconds') + '-04:00'
atom_feed = atom_template.format(
last_update=last_update,
entries=entries_io.getvalue())