diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2012-11-13 23:48:18 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2012-11-13 23:48:18 -0500 |
| commit | e92f8608664381b6002a025e490588df208234cc (patch) | |
| tree | e1ed11f03bd8af45999d21b3e1e2b4379721a5ca | |
| parent | 7bc18ad4630fe4c525ccb66f21d47486d5c48b2b (diff) | |
| download | famille-flask-e92f8608664381b6002a025e490588df208234cc.tar.gz | |
fix dates in rss feed
| -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 %} |
