From 6445f312041322df1b42eb2b5974d5b1c73dcb68 Mon Sep 17 00:00:00 2001 From: Bastian Venthur Date: Mon, 29 Mar 2021 12:39:52 +0200 Subject: [PATCH] fixed bug so empty tags don't throw an error --- blag/blag.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blag/blag.py b/blag/blag.py index 32ce497..44350aa 100644 --- a/blag/blag.py +++ b/blag/blag.py @@ -392,7 +392,7 @@ def generate_tags(articles, tags_template, tag_template, output_dir): # get tags number of occurrences all_tags = {} for _, context in articles: - tags = context.get('tags', None) + tags = context.get('tags', []) for tag in tags: all_tags[tag] = all_tags.get(tag, 0) + 1 # sort by occurrence @@ -405,7 +405,7 @@ def generate_tags(articles, tags_template, tag_template, output_dir): # get tags and archive per tag all_tags = {} for dst, context in articles: - tags = context.get('tags', None) + tags = context.get('tags', []) for tag in tags: archive = all_tags.get(tag, []) entry = context.copy()