Commit 3902aa22 authored by Brendan Hoar's avatar Brendan Hoar Committed by GitHub

Better error handling to skip non-standard ss_tag_frequency content

parent ddb28b33
...@@ -21,7 +21,9 @@ re_comma = re.compile(r" *, *") ...@@ -21,7 +21,9 @@ re_comma = re.compile(r" *, *")
def build_tags(metadata): def build_tags(metadata):
tags = {} tags = {}
for _, tags_dict in metadata.get("ss_tag_frequency", {}).items(): ss_tag_frequency = metadata.get("ss_tag_frequency", {})
if ss_tag_frequency is not None and hasattr(ss_tag_frequency, 'items'):
for _, tags_dict in ss_tag_frequency.items():
for tag, tag_count in tags_dict.items(): for tag, tag_count in tags_dict.items():
tag = tag.strip() tag = tag.strip()
tags[tag] = tags.get(tag, 0) + int(tag_count) tags[tag] = tags.get(tag, 0) + int(tag_count)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment