Fix timestamps again

This commit is contained in:
Guillaume Ayoub 2019-02-04 14:31:56 +01:00
parent baf34b753c
commit 532d95d415
2 changed files with 5 additions and 6 deletions

View File

@ -264,9 +264,10 @@ def feed(name):
abort(404)
entries = []
for post in data.get_posts(name, data.STATE_PUBLISHED, end=50):
timestamp = post[data.TIMESTAMP]
post['timestamp'] = post[data.TIMESTAMP]
post['link'] = url_for(
'post', name=name, timestamp=timestamp, _external=True
'post', name=name, timestamp=post['timestamp'],
_external=True
)
entries.append({'content': post})
title = f'{data.POSTS[name]} AFPy.org'
@ -322,7 +323,7 @@ def status():
@app.template_filter('rfc822_datetime')
def format_rfc822_datetime(timestamp):
return email.utils.formatdate(timestamp)
return email.utils.formatdate(int(timestamp))
@app.template_filter('parse_iso_datetime')

View File

@ -9,9 +9,7 @@
<title><![CDATA[ {% if entry.feed %}[{{ entry.feed | safe }}]{% endif %} {{ entry.content.title | safe }} ]]></title>
<description><![CDATA[ {{ (entry.content.description or entry.content.summary) | safe }} ]]></description>
<link>{{ entry.content.link }}</link>
{% if entry.content.timestamp %}
<pubDate>{{ entry.content.timestamp | rfc822_datetime }}</pubDate>
{% endif %}
<pubDate>{{ entry.content.timestamp | rfc822_datetime }}</pubDate>
</item>
{% endfor %}
</channel>