ckanext-spatial icon indicating copy to clipboard operation
ckanext-spatial copied to clipboard

skip harvesting during import

Open knudmoeller opened this issue 6 years ago • 1 comments

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.

knudmoeller avatar Nov 13 '17 11:11 knudmoeller