Use proper content-type for RSS feed

This commit is contained in:
Noah 2014-04-11 18:08:14 +00:00
parent d90ddffb0a
commit 1cbf93502d

View File

@ -2,7 +2,7 @@
"""Endpoints for the web blog.""" """Endpoints for the web blog."""
from flask import Blueprint, g, request, redirect, url_for, session, flash from flask import Blueprint, g, request, redirect, url_for, session, flash, make_response
import re import re
import datetime import datetime
import calendar import calendar
@ -291,7 +291,9 @@ def rss():
["pubDate", time.strftime(rss_time, time.gmtime(post["time"]))], ["pubDate", time.strftime(rss_time, time.gmtime(post["time"]))],
]) ])
return doc.toprettyxml(encoding="utf-8") resp = make_response(doc.toprettyxml(encoding="utf-8"))
resp.headers["Content-Type"] = "application/rss+xml; charset=utf-8"
return resp
def xml_add_text_tags(doc, root_node, tags): def xml_add_text_tags(doc, root_node, tags):
@ -423,4 +425,4 @@ def partial_tags():
g.info["tags"] = result g.info["tags"] = result
g.info["has_small"] = has_small g.info["has_small"] = has_small
return template("blog/categories.inc.html") return template("blog/categories.inc.html")