Skip to content

Commit 0e77846

Browse files
authored
use conditionapplyingtoaccessanduse to populate oa-records:rights (#1078)
* use conditionapplyingtoaccessanduse to populate oa-records:rights suggestion for #1077 * null check for md.rights
1 parent 4d7e5f7 commit 0e77846

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pycsw/core/metadata.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,7 @@ def _parse_dc(context, repos, exml):
16701670
_set(context, recobj, 'pycsw:AlternateTitle', md.alternative)
16711671
_set(context, recobj, 'pycsw:Abstract', md.abstract)
16721672

1673-
if len(md.subjects) > 0 and None not in md.subjects:
1673+
if md.subjects is not None and len(md.subjects) > 0 and None not in md.subjects:
16741674
_set(context, recobj, 'pycsw:Keywords', ','.join(md.subjects))
16751675

16761676
_set(context, recobj, 'pycsw:ParentIdentifier', md.ispartof)
@@ -1682,6 +1682,8 @@ def _parse_dc(context, repos, exml):
16821682
_set(context, recobj, 'pycsw:Publisher', md.publisher)
16831683
_set(context, recobj, 'pycsw:Contributor', md.contributor)
16841684
_set(context, recobj, 'pycsw:OrganizationName', md.rightsholder)
1685+
if md.rights is not None and len(md.rights) > 0 and None not in md.rights:
1686+
_set(context, recobj, 'pycsw:ConditionApplyingToAccessAndUse', ','.join(md.rights))
16851687
_set(context, recobj, 'pycsw:AccessConstraints', md.accessrights)
16861688
_set(context, recobj, 'pycsw:OtherConstraints', md.license)
16871689
_set(context, recobj, 'pycsw:Date', md.date)

pycsw/ogc/api/records.py

+4
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,10 @@ def record2json(record, url, collection, mode='ogcapi-records'):
12011201
record.otherconstraints = [record.otherconstraints]
12021202
record_dict['properties']['license'] = ", ".join(record.otherconstraints)
12031203

1204+
if record.conditionapplyingtoaccessanduse:
1205+
if isinstance(record.conditionapplyingtoaccessanduse, str) and record.conditionapplyingtoaccessanduse not in [None, 'None']:
1206+
record_dict['properties']['rights'] = record.conditionapplyingtoaccessanduse
1207+
12041208
record_dict['properties']['updated'] = record.insert_date
12051209

12061210
if record.type:

0 commit comments

Comments
 (0)