diff options
| -rw-r--r-- | famille.py | 7 | ||||
| -rw-r--r-- | templates/rss.xml | 2 |
2 files changed, 8 insertions, 1 deletions
@@ -10,6 +10,8 @@ import pytz from docutils import core from docutils.writers.html4css1 import Writer from datetime import datetime +import time +from email import utils from bs4 import BeautifulSoup from flask_mail import Mail, Message import locale @@ -52,6 +54,11 @@ def format_ago(date_object, format): return '<span class=timeago title="{0}">{1}</span>'. \ format(iso_format, readable).decode("utf8") +@app.template_filter('format_rfc2822') +def format_rfc2822(date_object): + timestamp = time.mktime(date_object.timetuple()) + return utils.formatdate(timestamp) + @app.template_filter('pluralize') def pluralize(word, count, plural=None): if count == 0: diff --git a/templates/rss.xml b/templates/rss.xml index d0e7caa..82363cb 100644 --- a/templates/rss.xml +++ b/templates/rss.xml @@ -11,7 +11,7 @@ <author>{{news.name}}</author> <link>http://famille.horel.org{{url_for('show_news', news_id=news.id)}}</link> <description>{{news.content_cache}}</description> -<pubDate>{{news.date}}</pubDate> +<pubDate>{{news.date|format_rfc2822}}</pubDate> <guid>{{news.id}}</guid> </item> {% endfor %} |
