Skip to content

Commit

Permalink
fix #1019 protect all_keywords (#1020)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvgenuchten authored Sep 26, 2024
1 parent b556ed5 commit d5201a8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pycsw/core/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d5201a8

Please sign in to comment.