Merge branch 'master' of https://github.com/LondonAppDev/ckanext-harvest into LondonAppDev-master

This commit is contained in:
amercader 2016-02-17 09:28:30 +00:00
commit 566939a655
1 changed files with 11 additions and 0 deletions

View File

@ -87,6 +87,17 @@ class Harvest(p.SingletonPlugin, DefaultDatasetForm, DefaultTranslation):
return data_dict return data_dict
def before_search(self, search_params):
'''Prevents the harvesters being shown in dataset search results.'''
fq = search_params.get('fq', '')
if 'dataset_type:{0}'.format('harvest') not in fq:
fq = "{0} -dataset_type:{1}".format(search_params.get('fq', ''),
'harvest')
search_params.update({'fq': fq})
return search_params
def after_show(self, context, data_dict): def after_show(self, context, data_dict):
if 'type' in data_dict and data_dict['type'] == DATASET_TYPE_NAME: if 'type' in data_dict and data_dict['type'] == DATASET_TYPE_NAME: