geopython / pycsw

pycsw is an OGC CSW server implementation written in Python. pycsw fully implements the OpenGIS Catalogue Service Implementation Specification [Catalogue Service for the Web]. Initial development started in 2010 (more formally announced in 2011). The project is certified OGC Compliant, and is an OGC Reference Implementation. pycsw allows for the publishing and discovery of geospatial metadata via numerous APIs (CSW 2/CSW 3, OpenSearch, OAI-PMH, SRU). Existing repositories of geospatial metadata can also be exposed, providing a standards-based metadata and catalogue component of spatial data infrastructures. pycsw is Open Source, released under an MIT license, and runs on all major platforms (Windows, Linux, Mac OS X). Please read the docs at https://pycsw.org/docs for more information.
https://pycsw.org
MIT License
203 stars 155 forks source link

admin import fails if keyword list contains a None #984

Open pvgenuchten opened 1 month ago

pvgenuchten commented 1 month ago

Found this in my logs, when importing some iso records

  File "/harvesters/record-to-pycsw/metadata.py", line 126, in <module>
    record = metadata.parse_record(context, metadata_record, repo)
  File "/harvesters/lib/python3.10/site-packages/pycsw/core/metadata.py", line 119, in parse_record
    return _parse_metadata(context, repos, record)
  File "/harvesters/lib/python3.10/site-packages/pycsw/core/metadata.py", line 149, in _parse_metadata
    return [_parse_iso(context, repos, exml)]
  File "/harvesters/lib/python3.10/site-packages/pycsw/core/metadata.py", line 1429, in _parse_iso
    _set(context, recobj, 'pycsw:Keywords', ','.join([k.name for k in all_keywords]))
TypeError: sequence item 0: expected str instance, NoneType found
Could not parse 33208a53-4973-4516-8f16-5ef82e20fd3b as record, sequence item 0: expected str instance, NoneType found, None

similar for bands

  File "/harvesters/record-to-pycsw/metadata.py", line 126, in <module>
    record = metadata.parse_record(context, metadata_record, repo)
  File "/harvesters/lib/python3.10/site-packages/pycsw/core/metadata.py", line 119, in parse_record
    return _parse_metadata(context, repos, record)
  File "/harvesters/lib/python3.10/site-packages/pycsw/core/metadata.py", line 149, in _parse_metadata
    return [_parse_iso(context, repos, exml)]
  File "/harvesters/lib/python3.10/site-packages/pycsw/core/metadata.py", line 1528, in _parse_iso
    for band in ci.bands:
AttributeError: 'MD_FeatureCatalogueDescription' object has no attribute 'bands'
Could not parse 2e0566eb-af7c-493c-abec-81f990c96161 as record, 'MD_FeatureCatalogueDescription' object has no attribute 'bands', None

records.zip