ckan / ckan/ckanext-spatial

skip harvesting during import

Open
#191 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
XSLT
Stars
136
Forks
207
PR merge metrics
No merged PRs in 30d

Description

I'm working on a harvester that inherits from `ckanext.spatial.harvesters.CSWHarvester`. To this end, I overwrite `ckanext.spatial.harvesters.SpatialHarvester.get_package_dict`.

I'd like to be able to abort harvesting a dataset during import stage (I need to be able to look at the dataset's metadata to decide if I really want to import it), without generating an error.

According to the documentation in https://github.com/ckan/ckanext-harvest#the-harvesting-interface, `import_stage` should return `'unchanged'` in such cases. So, the desired behaviour could be achieved by adding a small test to `ckanext.spatial.harvesters.SpatialHarvester.import_stage` to check the return value from `get_package_dict` (`if package_dict == 'skip'`) and return `'unchanged'` if true. I've implemented this and it works fine for me.

Does this make sense? If so, I have a pull request ready.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.