Skip to content

[records] contacts from roles fix #1130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions pycsw/ogc/api/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,16 +1285,15 @@ def record2json(record, url, collection, mode='ogcapi-records'):
})
except Exception as err:
LOGGER.exception(f"failed to parse contact of {record.identifier}: {err}")
for r2 in "creator,publisher,contributor".split(","): # match role-fields with contacts
if r2 not in roles and hasattr(record, r2) and record[r2] not in [None, '']:
rcnt.append({
'organization': record[r2],
'roles': [r2]
})

except Exception as err:
LOGGER.warning(f"failed to parse contacts json of {record.identifier}: {err}")

for r2 in ["creator","publisher","contributor"]: # match role-fields with contacts
if r2 not in roles and hasattr(record, r2) and getattr(record, r2) not in [None, '']:
rcnt.append({
'organization': getattr(record, r2),
'roles': [r2]
})
if len(rcnt) > 0:
record_dict['properties']['contacts'] = rcnt

if record.themes not in [None, '', 'null']:
Expand Down
Loading