Fix incorrect RSS Feed generator
This commit is contained in:
@@ -12,12 +12,11 @@
|
|||||||
<description> {{ blog_description }} </description>
|
<description> {{ blog_description }} </description>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<language>fr</language>
|
<language>fr</language>
|
||||||
<lastBuildDate> {{ last_build_date }} </lastBuildDate>
|
|
||||||
|
|
||||||
{% for post in posts %}
|
{% for post in posts %}
|
||||||
<item>
|
<item>
|
||||||
<title> {{ post.title }} </title>
|
<title> {{ post.title }} </title>
|
||||||
<pubdate> {% if post.last_updated %} {{ post.last_updated }} {% else %} {{ post.time }} {% endif %} </pubdate>
|
<pubdate> {% if post.last_updated %} {{ post.last_updated }} {% else %} {{ post.creation_date }} {% endif %} </pubdate>
|
||||||
<link> {{base_url}}/{{ url_for('blog.viewArticle', username=post.author, title_id=post.title_id) }}</link>
|
<link> {{base_url}}/{{ url_for('blog.viewArticle', username=post.author, title_id=post.title_id) }}</link>
|
||||||
<guid> {{base_url}}/{{ url_for('blog.viewArticle', username=post.author, title_id=post.title_id) }} </guid>
|
<guid> {{base_url}}/{{ url_for('blog.viewArticle', username=post.author, title_id=post.title_id) }} </guid>
|
||||||
|
|
||||||
@@ -26,7 +25,7 @@
|
|||||||
</description>
|
</description>
|
||||||
|
|
||||||
<content:encoded>
|
<content:encoded>
|
||||||
{{ post.content | safe }}
|
{{ post.content }}
|
||||||
</content:encoded>
|
</content:encoded>
|
||||||
</item>
|
</item>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
+19
-8
@@ -11,6 +11,7 @@ import re
|
|||||||
from shutil import copy
|
from shutil import copy
|
||||||
from tools.utils import login_required
|
from tools.utils import login_required
|
||||||
|
|
||||||
|
|
||||||
blog = Blueprint('blog', __name__, template_folder='templates')
|
blog = Blueprint('blog', __name__, template_folder='templates')
|
||||||
|
|
||||||
app = Flask( 'pywallter' )
|
app = Flask( 'pywallter' )
|
||||||
@@ -262,14 +263,20 @@ def viewauthorrss(author):
|
|||||||
if list_posts != None:
|
if list_posts != None:
|
||||||
last_build=last_article_date[0]
|
last_build=last_article_date[0]
|
||||||
for post in list_posts:
|
for post in list_posts:
|
||||||
posts=[dict(title_id=post[0], title=post[1], subtitle=post[2], content=markdown(post[3], extensions=MARKDOWN_EXT), creation_date=post[4],
|
|
||||||
|
# Build date to RFC822 format
|
||||||
|
date_post = time.strptime(post[4], '%d/%m/%Y %H:%M:%S')
|
||||||
|
posts=[dict(title_id=post[0], title=post[1], subtitle=post[2], content=markdown(post[3], extensions=MARKDOWN_EXT),
|
||||||
|
creation_date=time.strftime("%a, %d %b %Y %H:%M:%S", date_post) + time.strftime(' %Z'),
|
||||||
author=post[5], status=post[6])] + posts
|
author=post[5], status=post[6])] + posts
|
||||||
|
|
||||||
return render_template('blog_rss.xml',
|
resp = make_response(render_template('blog_rss.xml',
|
||||||
base_url=BASE_URL,
|
base_url=BASE_URL,
|
||||||
blog_name=author,
|
blog_name=author,
|
||||||
last_build_date=last_build,
|
last_build_date=last_build,
|
||||||
posts=posts)
|
posts=posts))
|
||||||
|
resp.headers['Content-type'] = 'application/xml; charset=utf-8'
|
||||||
|
return resp
|
||||||
|
|
||||||
|
|
||||||
@blog.route('/blog/private_unified/<username>/<title_id>', methods=['GET'])
|
@blog.route('/blog/private_unified/<username>/<title_id>', methods=['GET'])
|
||||||
@@ -322,13 +329,17 @@ def viewrss():
|
|||||||
if list_posts != None:
|
if list_posts != None:
|
||||||
last_build=last_article_date[0]
|
last_build=last_article_date[0]
|
||||||
for post in list_posts:
|
for post in list_posts:
|
||||||
posts=[dict(title_id=post[0], title=post[1], subtitle=post[2], content=markdown(post[3], extensions=MARKDOWN_EXT), creation_date=post[4],
|
# Build date to RFC822 format
|
||||||
|
date_post = time.strptime(post[4], '%d/%m/%Y %H:%M:%S')
|
||||||
|
posts=[dict(title_id=post[0], title=post[1], subtitle=post[2], content=markdown(post[3], extensions=MARKDOWN_EXT),
|
||||||
|
creation_date=time.strftime("%a, %d %b %Y %H:%M:%S", date_post) + time.strftime(' %Z'),
|
||||||
author=post[5], status=post[6])] + posts
|
author=post[5], status=post[6])] + posts
|
||||||
|
|
||||||
return render_template('blog_rss.xml',
|
resp = make_response(render_template('blog_rss.xml',
|
||||||
base_url=BASE_URL,
|
base_url=BASE_URL,
|
||||||
blog_name= TITLE_SERVER,
|
blog_name= TITLE_SERVER,
|
||||||
last_build_date=last_build,
|
last_build_date=last_build,
|
||||||
blog_description=DESC_SERVER,
|
blog_description=DESC_SERVER,
|
||||||
posts=posts)
|
posts=posts))
|
||||||
|
resp.headers['Content-type'] = 'application/xml; charset=utf-8'
|
||||||
|
return resp
|
||||||
|
|||||||
Reference in New Issue
Block a user