From 73e3b67df26729c12e08cb1d735b23eed5c701cf Mon Sep 17 00:00:00 2001 From: kitoy Date: Sat, 31 Oct 2026 02:09:21 +0100 Subject: [PATCH] Pass the rss validator --- templates/blog_rss.xml | 6 ++---- tools/clean_dates_blogs_post.py | 4 ++-- views/blog.py | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/templates/blog_rss.xml b/templates/blog_rss.xml index e2f2a66..1084160 100644 --- a/templates/blog_rss.xml +++ b/templates/blog_rss.xml @@ -5,20 +5,18 @@ xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"> - Le blog de {{ blog_name }} {{ base_url }}/blog/ - {% if blog_description %} {{ blog_description }} - {% endif %} fr + {% for post in posts %} {{ post.title }} - {% if post.last_updated %} {{ post.last_updated }} {% else %} {{ post.creation_date }} {% endif %} + {% if post.last_updated %}{{ post.last_updated }}{% else %}{{ post.creation_date }}{% endif %} {{base_url}}/{{ url_for('blog.viewArticle', username=post.author, title_id=post.title_id) }} {{base_url}}/{{ url_for('blog.viewArticle', username=post.author, title_id=post.title_id) }} diff --git a/tools/clean_dates_blogs_post.py b/tools/clean_dates_blogs_post.py index 4f6d2f6..310504b 100644 --- a/tools/clean_dates_blogs_post.py +++ b/tools/clean_dates_blogs_post.py @@ -25,7 +25,7 @@ for post in list_posts: try: date_post = time.strptime(post[1], '%d/%m/%Y %H:%M:%S') except: - print(title +'-- Posted at: '+ post[1] + ' Not modified: The date is not in the old format') + print(title +'-- Posted at: '+ str(post[1]) + ' Not modified: The date is not in the old format') newDatePost = post[1] else: newDatePost = time.strftime("%Y-%m-%d %H:%M:%S", date_post) @@ -33,7 +33,7 @@ for post in list_posts: try: last_updated_post = time.strptime(post[2], '%d/%m/%Y %H:%M:%S') except: - print(title + '-- Updated at '+ post[2] + ' Not modified: The date is not in the old format') + print(title + '-- Updated at '+ str(post[2]) + ' Not modified: The date is not in the old format') newDateUpdatedPost = post[2] else: newDateUpdatedPost = time.strftime("%Y-%m-%d %H:%M:%S", last_updated_post) diff --git a/views/blog.py b/views/blog.py index d605528..7781e9d 100644 --- a/views/blog.py +++ b/views/blog.py @@ -302,7 +302,7 @@ def viewauthorrss(author): # Build date to RFC822 format date_post = time.strptime(post[4], "%Y-%m-%d %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'), + creation_date=time.strftime("%a, %d %b %Y %H:%M:%S", date_post) + time.strftime(' %z'), author=post[5], status=post[6])] + posts resp = make_response(render_template('blog_rss.xml', @@ -371,7 +371,7 @@ def viewrss(): # Build date to RFC822 format date_post = time.strptime(post[4], "%Y-%m-%d %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'), + creation_date=time.strftime("%a, %d %b %Y %H:%M:%S", date_post) + time.strftime(' %z'), author=post[5], status=post[6])] + posts resp = make_response(render_template('blog_rss.xml',