make atom file timestamp = current time
This commit is contained in:
parent
8b0570438c
commit
95fb136689
5
build.py
5
build.py
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
import datetime
|
||||||
import glob
|
import glob
|
||||||
import html
|
import html
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
@ -169,11 +170,9 @@ def make_atom_feed():
|
|||||||
blog_entries.sort(key=operator.itemgetter('date'))
|
blog_entries.sort(key=operator.itemgetter('date'))
|
||||||
|
|
||||||
entries_io = StringIO()
|
entries_io = StringIO()
|
||||||
last_update = None
|
|
||||||
for entry in blog_entries:
|
for entry in blog_entries:
|
||||||
# We lie and pretend that all entries were written at noon EST.
|
# We lie and pretend that all entries were written at noon EST.
|
||||||
update_date = entry['date'] + 'T12:00:00-04:00'
|
update_date = entry['date'] + 'T12:00:00-04:00'
|
||||||
last_update = update_date
|
|
||||||
entries_io.write(entry_template.format(
|
entries_io.write(entry_template.format(
|
||||||
url=entry['url'],
|
url=entry['url'],
|
||||||
title=entry['title'],
|
title=entry['title'],
|
||||||
@ -183,6 +182,8 @@ def make_atom_feed():
|
|||||||
|
|
||||||
entries_text = entries_io.getvalue()
|
entries_text = entries_io.getvalue()
|
||||||
|
|
||||||
|
now = datetime.datetime.now()
|
||||||
|
last_update = datetime.datetime.isoformat(now, 'T', 'seconds') + '-04:00'
|
||||||
atom_feed = atom_template.format(
|
atom_feed = atom_template.format(
|
||||||
last_update=last_update,
|
last_update=last_update,
|
||||||
entries=entries_io.getvalue())
|
entries=entries_io.getvalue())
|
||||||
|
Loading…
Reference in New Issue
Block a user