From c096a8fa6e94d2d8194631bcb37ea86a1d378227 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Mon, 30 Sep 2019 19:53:36 +0100 Subject: [PATCH] artist name can but None --- depicts/wdqs.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/depicts/wdqs.py b/depicts/wdqs.py index cbacf79..ab377fc 100644 --- a/depicts/wdqs.py +++ b/depicts/wdqs.py @@ -81,8 +81,9 @@ def build_browse_item_map(bindings): item = { 'image_filename': image_filename, 'date': d, - 'artist_name': artist_name, } + if artist_name: + item['artist_name'] = artist_name if label != row_qid: item['label'] = label @@ -104,8 +105,9 @@ def build_browse_item_map(bindings): lang, title = item['title'] titles[lang] = title filenames.add(item['image_filename']) - if item['artist_name'] not in artist_names: - artist_names.append(item['artist_name']) + artist_name = item.get('artist_name') + if artist_name and artist_name not in artist_names: + artist_names.append(artist_name) if 'label' in item: labels.add(item['label']) @@ -115,6 +117,8 @@ def build_browse_item_map(bindings): 'image_filename': list(filenames), 'artist_name': ', '.join(artist_names), } + if artist_names: + item['artist_name'] = ', '.join(artist_names) if labels: assert len(labels) == 1 item['label'] = list(labels)[0]