[#227] 'harvest_source_show_status' not found

Added try block and try to clear action's cache in case exception raised
This commit is contained in:
Motornyuk Sergey 2016-03-21 14:35:09 +02:00
parent 7f506913f8
commit e1ebde7030
1 changed files with 8 additions and 1 deletions

View File

@ -107,7 +107,14 @@ class Harvest(p.SingletonPlugin, DefaultDatasetForm, DefaultTranslation):
log.error('Harvest source not found for dataset {0}'.format(data_dict['id'])) log.error('Harvest source not found for dataset {0}'.format(data_dict['id']))
return data_dict return data_dict
data_dict['status'] = p.toolkit.get_action('harvest_source_show_status')(context, {'id': source.id}) st_action_name = 'harvest_source_show_status'
try:
status_action = p.toolkit.get_action(st_action_name)
except KeyError:
logic.clear_actions_cache()
status_action = p.toolkit.get_action(st_action_name)
data_dict['status'] = status_action(context, {'id': source.id})
elif not 'type' in data_dict or data_dict['type'] != DATASET_TYPE_NAME: elif not 'type' in data_dict or data_dict['type'] != DATASET_TYPE_NAME:
# This is a normal dataset, check if it was harvested and if so, add # This is a normal dataset, check if it was harvested and if so, add