-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
adds the contactinfo from dedicated role fields #1014
adds the contactinfo from dedicated role fields #1014
Conversation
@@ -1215,6 +1217,13 @@ 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think record
is an object here (not a dict)? Perhaps the below can work?
for r2 in ['creator', 'publisher', 'contributor']: # match role-fields with contacts
if r2 not in roles and getattr(record, r2, None) not in [None, '']:
rcnt.append({
'organization': getattr(record, r2),
'roles': [r2]
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanx tom, you're right, now fixed and tested
766db72
to
019ef9a
Compare
pycsw/core/metadata.py
Outdated
@@ -1651,6 +1651,8 @@ def _parse_dc(context, repos, exml): | |||
|
|||
md = CswRecord(exml) | |||
|
|||
print(md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove print statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
adds the contactinfo from dedicated role fields, if the role does not…already exists in contacts
Overview
the ogcapi- records json fully depends on record.contacts, however in some cases records.contacts is not populated (for example from dublin core), then fall back to the explicit role fields 'creator', 'publisher', 'contributor'.
(as per https://github.com/geopython/pycsw/blob/master/CONTRIBUTING.rst#contributions-and-licensing)