Fix incorrect RSS Feed generator
This commit is contained in:
+19
-8
@@ -11,6 +11,7 @@ import re
|
||||
from shutil import copy
|
||||
from tools.utils import login_required
|
||||
|
||||
|
||||
blog = Blueprint('blog', __name__, template_folder='templates')
|
||||
|
||||
app = Flask( 'pywallter' )
|
||||
@@ -262,14 +263,20 @@ def viewauthorrss(author):
|
||||
if list_posts != None:
|
||||
last_build=last_article_date[0]
|
||||
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
|
||||
|
||||
return render_template('blog_rss.xml',
|
||||
resp = make_response(render_template('blog_rss.xml',
|
||||
base_url=BASE_URL,
|
||||
blog_name=author,
|
||||
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'])
|
||||
@@ -322,13 +329,17 @@ def viewrss():
|
||||
if list_posts != None:
|
||||
last_build=last_article_date[0]
|
||||
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
|
||||
|
||||
return render_template('blog_rss.xml',
|
||||
|
||||
resp = make_response(render_template('blog_rss.xml',
|
||||
base_url=BASE_URL,
|
||||
blog_name= TITLE_SERVER,
|
||||
last_build_date=last_build,
|
||||
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