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

CSW client code fails to process MI_Metadata #209

Open
benjwadams opened this issue Nov 29, 2018 · 1 comment
Open

CSW client code fails to process MI_Metadata #209

benjwadams opened this issue Nov 29, 2018 · 1 comment

Comments

@benjwadams
Copy link

Attempting to harvest from a CSW with ISO metadata starting with MI_Metadata, rather than MD_Metadata fails:

https://github.com/ckan/ckanext-spatial/blob/master/ckanext/spatial/lib/csw_client.py#L178-L189

Essentially, the call to .find does not find MD_Metadata, and so returns None, which gets propagated down to this line:

record["xml"] = '<?xml version="1.0" encoding="UTF-8"?>\n' + record["xml"]

This raises an exception since concatenating a string with None is not a valid operation. This could be fairly easily fixed by adding in the MI_Metadata as a valid element to find as well.
In fact, it looks like the data.gov fork of ckanext-spatial does just that:
https://github.com/GSA/ckanext-spatial/blob/datagov/ckanext/spatial/lib/csw_client.py#L171
Additionally, cases in which root elements which weren't MD_Metadata or MI_Metadata should be handled early so that a sane error message is raised, rather than an error about concatenating string to None, which does not make the reason for failure particularly clear .

@benjwadams
Copy link
Author

Related #210

ccancellieri added a commit to ccancellieri/ckanext-spatial that referenced this issue Oct 22, 2021
…mespace and tag name so we can now harvest any kind of metadata (if validation is provided or ignored) ckan#209 ckan#210 ckan#219 ckan#258
ccancellieri added a commit to ccancellieri/ckanext-spatial that referenced this issue Oct 22, 2021
…mespace and tag name so we can now harvest any kind of metadata (if validation is provided or ignored) ckan#209 ckan#210 ckan#219 ckan#258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant