fixed rss errors

master
tiyn 8 months ago
parent a4d2290e47
commit 2a2a5f77b6

@ -129,7 +129,8 @@ def feed():
content_string=content, content_string=content,
title=TITLE, title=TITLE,
description=DESCRIPTION, description=DESCRIPTION,
website=WEBSITE) website=WEBSITE,
language=LANGUAGE)
response = make_response(feed_xml) response = make_response(feed_xml)
response.headers["Content-Type"] = "application/rss+xml" response.headers["Content-Type"] = "application/rss+xml"
return response return response

@ -159,6 +159,7 @@ def get_rss_string():
Returns: Returns:
string: rss-string of everything that is in the ENTRY_DIR. string: rss-string of everything that is in the ENTRY_DIR.
""" """
locale.setlocale(locale.LC_TIME, "en_US.UTF-8")
path_ex = ENTRY_DIR path_ex = ENTRY_DIR
content_string = "" content_string = ""
if path.exists(path_ex): if path.exists(path_ex):
@ -178,12 +179,13 @@ def get_rss_string():
"/index.html#" + filename + "</guid>\n" "/index.html#" + filename + "</guid>\n"
content_string += "<pubDate>" + \ content_string += "<pubDate>" + \
datetime.fromtimestamp(os.path.getmtime(file)).strftime( datetime.fromtimestamp(os.path.getmtime(file)).strftime(
"%Y-%m-%d") + "</pubDate>\n" "%a, %d %b %Y %H:%M:%S") + " +0100</pubDate>\n"
content_string += "<description>" content_string += "<description>\n<![CDATA[<html>\n<head>\n</head>\n<body>\n"
for line in text: for line in text:
content_string += line content_string += line
content_string += "</description>\n" content_string += "\n</body></html>\n]]>\n</description>\n"
content_string += "</item>\n" content_string += "</item>\n"
locale.setlocale(locale.LC_TIME, LOCAL)
return content_string return content_string

@ -5,8 +5,8 @@
<title>{{ title }}</title> <title>{{ title }}</title>
<description>{{ description }}</description> <description>{{ description }}</description>
<language>{{ language }}</language> <language>{{ language }}</language>
<link>{{ url_for('feed') }}</link> <link>{{ website }}</link>
<atom:link href="{{ url_for('feed') }}" rel="self" type="application/rss+xml" /> <atom:link href="{{ website }}{{ url_for('feed') }}" rel="self" type="application/rss+xml" />
{% autoescape off %} {% autoescape off %}
{{ content_string }} {{ content_string }}

Loading…
Cancel
Save