From cd6c1b56a8d433cf70cb707a6c0abc321144afe2 Mon Sep 17 00:00:00 2001 From: amercader Date: Wed, 13 Mar 2013 17:31:39 +0000 Subject: [PATCH] [#18] Get package dict on after_delete to check type No need for #615 in core then --- ckanext/harvest/plugin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ckanext/harvest/plugin.py b/ckanext/harvest/plugin.py index fdc01e3..64c8ee7 100644 --- a/ckanext/harvest/plugin.py +++ b/ckanext/harvest/plugin.py @@ -47,9 +47,12 @@ class Harvest(p.SingletonPlugin, DefaultDatasetForm): _update_harvest_source_object(context, data_dict) def after_delete(self, context, data_dict): - if 'type' in data_dict and data_dict['type'] == DATASET_TYPE_NAME: + + package_dict = p.toolkit.get_action('package_show')(context, {'id': data_dict['id']}) + + if 'type' in package_dict and package_dict['type'] == DATASET_TYPE_NAME: # Delete the actual HarvestSource object - _delete_harvest_source_object(context, data_dict) + _delete_harvest_source_object(context, package_dict) def after_show(self, context, data_dict):