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
197 stars 153 forks source link

federated catalogues None error #947

Closed pvgenuchten closed 4 months ago

pvgenuchten commented 5 months ago

Description

if I set federated catalogues to None, i run into this error on /collections/metadata:main, what is the best way to deactivate federated catalogues?

image

Environment

pvgenuchten commented 5 months ago

seems better to remove the full key in stead of making it empty

https://github.com/geopython/pycsw/blob/ac81aa8f3c362b8fa76439bb94189c943cffb267/pycsw/ogc/api/records.py#L1021

tomkralidis commented 5 months ago

Thanks @pvgenuchten. Would the following work instead?

diff --git a/pycsw/ogc/api/records.py b/pycsw/ogc/api/records.py
index 83c3179e..59c077ac 100644
--- a/pycsw/ogc/api/records.py
+++ b/pycsw/ogc/api/records.py
@@ -1018,7 +1018,7 @@ class API:
         }

         if collection_name == 'metadata:main':
-            if 'federatedcatalogues' in self.config:
+            if self.config.get('federatedcatalogues') is not None:
                 LOGGER.debug('Adding federated catalogues')
                 collection_info['federatedCatalogues'] = []
                 for fc in self.config.get('federatedcatalogues', []):
pvgenuchten commented 4 months ago

yes it would work, updating pr