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.
I'm working on a harvester that inherits from
ckanext.spatial.harvesters.CSWHarvester
. To this end, I overwriteckanext.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 tockanext.spatial.harvesters.SpatialHarvester.import_stage
to check the return value fromget_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.