From bc8ef963d8a1da8efa6886ff28ee906e55c9b090 Mon Sep 17 00:00:00 2001 From: Richard Hallett Date: Wed, 4 Dec 2019 17:23:35 +0100 Subject: [PATCH] Don't try and parse empty date attributes --- viringo/services/datacite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viringo/services/datacite.py b/viringo/services/datacite.py index 8d2edce..9062c2f 100644 --- a/viringo/services/datacite.py +++ b/viringo/services/datacite.py @@ -99,7 +99,7 @@ def build_metadata(data): result.publication_year = data['attributes'].get('publicationYear') or '' result.dates = [ - {'type': date['dateType'], 'date': date['date']} for date in data['attributes']['dates'] + {'type': date['dateType'], 'date': date['date']} for date in data['attributes']['dates'] if date.get('date') ] if data['attributes']['dates'] is not None else [] result.contributors = data['attributes'].get('contributors') or []