Skip to content
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

BUG: Fix embedded metadata elements #188

Merged
merged 1 commit into from Feb 24, 2018

Conversation

lesserwhirls
Copy link
Collaborator

Addresses the case where a metadata element pointing to an external metadata document, via xlink, is a child of a parent metadata element.

Fixes #179

dopplershift
dopplershift previously approved these changes Feb 24, 2018
Copy link
Member

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple little things, but nothing to hold it up for.

attributes = element.attrib
has_xlink_title = xlink_title_attr in attributes
has_xlink_href = xlink_href_attr in attributes
return (has_xlink_title and has_xlink_href)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for parens.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool - fixed.

cat = TDSCatalog(url)
md = cat.metadata
assert 'external_metadata' in md
assert 'serviceName' in md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sufficient to prove that it's working?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the embedded metadata element is successfully parsed and understood, then the external_metadata keyword will be added to the metadata dict. If the other metadata isn't added (because the embedded metadata element does not have inherited=true, which is currently the case), then the second assert will fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, works for me.

Addresses the case where a metadata element pointing to an external metadata document, via xlink, is a child of a parent metadata element.

Fixes Unidata#179
@dopplershift dopplershift added this to the 0.7 milestone Feb 24, 2018
@dopplershift dopplershift merged commit 2a9cc97 into Unidata:master Feb 24, 2018
@lesserwhirls lesserwhirls deleted the metadata branch June 4, 2020 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants