From df5f5165d65a31308aafa64012dd3dcfc35f26d0 Mon Sep 17 00:00:00 2001 From: Paul van Genuchten Date: Thu, 26 Sep 2024 19:28:46 +0200 Subject: [PATCH] fix #1019 protect all_keywords --- pycsw/core/metadata.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pycsw/core/metadata.py b/pycsw/core/metadata.py index c8838ebf9..4e26b0029 100644 --- a/pycsw/core/metadata.py +++ b/pycsw/core/metadata.py @@ -1448,11 +1448,12 @@ def _parse_iso(context, repos, exml): if (hasattr(md_identification, 'keywords') and len(md_identification.keywords) > 0): all_keywords = [item for sublist in md_identification.keywords for item in sublist.keywords if item is not None] - _set(context, recobj, 'pycsw:Keywords', ','.join([k.name for k in all_keywords])) - _set(context, recobj, 'pycsw:KeywordType', md_identification.keywords[0].type) - _set(context, recobj, 'pycsw:Themes', - json.dumps([t for t in md_identification.keywords if t.thesaurus is not None], - default=lambda o: o.__dict__)) + if all_keywords: + _set(context, recobj, 'pycsw:Keywords', ','.join([k.name for k in all_keywords if hasattr(k,'name')])) + _set(context, recobj, 'pycsw:KeywordType', md_identification.keywords[0].type) + _set(context, recobj, 'pycsw:Themes', + json.dumps([t for t in md_identification.keywords if t.thesaurus is not None], + default=lambda o: o.__dict__)) # Creator if (hasattr(md_identification, 'creator') and