From 8332fed3a43603613bdb421265022914b6d36c10 Mon Sep 17 00:00:00 2001 From: Markus Steinlein Date: Thu, 11 Mar 2021 20:46:16 +0100 Subject: [PATCH 1/3] Added german locale for date string. --- app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app.py b/app.py index 81d4ff4..caa5966 100755 --- a/app.py +++ b/app.py @@ -8,6 +8,7 @@ from flask_fontawesome import FontAwesome from datetime import datetime from fotogrid import fotogrid from feed import generate_feed +import locale # directly support jinja within markdown blogposts @@ -74,4 +75,5 @@ def rss(): if __name__ == '__main__': + locale.setlocale(locale.LC_TIME, "de_DE") app.run(host='0.0.0.0') From ec89bd287139bf6e81166137087cd2bd92ead9cc Mon Sep 17 00:00:00 2001 From: Markus Steinlein Date: Thu, 11 Mar 2021 20:49:00 +0100 Subject: [PATCH 2/3] Comments for fotogrid tests. --- tests/test_fotogrid.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/test_fotogrid.py b/tests/test_fotogrid.py index 5a34103..6facae8 100644 --- a/tests/test_fotogrid.py +++ b/tests/test_fotogrid.py @@ -6,14 +6,22 @@ from lxml import etree from io import StringIO def check_if_valid_html(html): + """ + GIVEN an html string + WHEN parsing the html string results in an error + THEN assert + """ parser = etree.HTMLParser(recover=False) etree.parse(StringIO(html), parser) assert len(parser.error_log) == 0 def test_fotogrid_empty_list(): - urls = [] - html = fotogrid(urls) + """ + WHEN creating a fotogrid without any image url + THEN expecting an empty result (no html code at all) + """ + html = fotogrid([]) assert len(html) == 0 @@ -26,7 +34,11 @@ def check_if_images_result_in(nbr_of_images, rows_expected, cols_expected): assert html.count(" Date: Thu, 11 Mar 2021 20:50:39 +0100 Subject: [PATCH 3/3] Added page content to feed. --- feed.py | 1 + 1 file changed, 1 insertion(+) diff --git a/feed.py b/feed.py index c813a1f..bb8fa88 100644 --- a/feed.py +++ b/feed.py @@ -26,6 +26,7 @@ def generate_feed(pages): fe.author(name=p.meta['author']) fe.description(p.meta['description']) fe.link(href='https://fdgl.rocks/' + p.path + '.html') + fe.content(p.html) response = make_response(fg.rss_str()) response.headers.set('Content-Type', 'application/rss+xml')