From d5201a8d9a0546bd0de2cf16ee3c47e9a392e76c Mon Sep 17 00:00:00 2001 From: Paul van Genuchten Date: Thu, 26 Sep 2024 22:19:10 +0200 Subject: [PATCH] fix #1019 protect all_keywords (#1020) --- 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