From 969e82a21809157ac98f4d365881bd274cf31bf4 Mon Sep 17 00:00:00 2001 From: Paul van Genuchten Date: Wed, 5 Feb 2025 22:14:00 +0100 Subject: [PATCH] use conditionapplyingtoaccessanduse to populate oa-records:rights suggestion for #1077 --- pycsw/core/metadata.py | 1 + pycsw/ogc/api/records.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/pycsw/core/metadata.py b/pycsw/core/metadata.py index 1c15ccacc..893ee1787 100644 --- a/pycsw/core/metadata.py +++ b/pycsw/core/metadata.py @@ -1682,6 +1682,7 @@ def _parse_dc(context, repos, exml): _set(context, recobj, 'pycsw:Publisher', md.publisher) _set(context, recobj, 'pycsw:Contributor', md.contributor) _set(context, recobj, 'pycsw:OrganizationName', md.rightsholder) + _set(context, recobj, 'pycsw:ConditionApplyingToAccessAndUse', md.rights) _set(context, recobj, 'pycsw:AccessConstraints', md.accessrights) _set(context, recobj, 'pycsw:OtherConstraints', md.license) _set(context, recobj, 'pycsw:Date', md.date) diff --git a/pycsw/ogc/api/records.py b/pycsw/ogc/api/records.py index e69f7c5e3..7df3abec9 100644 --- a/pycsw/ogc/api/records.py +++ b/pycsw/ogc/api/records.py @@ -1201,6 +1201,10 @@ def record2json(record, url, collection, mode='ogcapi-records'): record.otherconstraints = [record.otherconstraints] record_dict['properties']['license'] = ", ".join(record.otherconstraints) + if record.conditionapplyingtoaccessanduse: + if isinstance(record.conditionapplyingtoaccessanduse, str) and record.conditionapplyingtoaccessanduse not in [None, 'None']: + record_dict['properties']['rights'] = record.conditionapplyingtoaccessanduse + record_dict['properties']['updated'] = record.insert_date if record.type: