From d9440aa716ed04c35a398472cfd4d5a9e47425a8 Mon Sep 17 00:00:00 2001 From: Graeme Watt Date: Tue, 29 Oct 2024 14:54:05 +0000 Subject: [PATCH] inspire_api: tolerate missing legacy_creation_date * Closes #828. --- hepdata/modules/inspire_api/parser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hepdata/modules/inspire_api/parser.py b/hepdata/modules/inspire_api/parser.py index e10a61c8..52c3c70f 100644 --- a/hepdata/modules/inspire_api/parser.py +++ b/hepdata/modules/inspire_api/parser.py @@ -202,7 +202,8 @@ def updated_parsed_content_for_thesis(content, parsed_content): if 'date' in content['metadata']['thesis_info'].keys(): parsed_content['year'] = content['metadata']['thesis_info']['date'] if parsed_content['year'] is not None: - if content['metadata']['legacy_creation_date'][:4] == parsed_content['year']: + if ('legacy_creation_date' in content['metadata'].keys() and + content['metadata']['legacy_creation_date'][:4] == parsed_content['year']): parsed_content['creation_date'] = content['metadata']['legacy_creation_date'] else: parsed_content['creation_date'] = expand_date(parsed_content['year'])