diff --git a/ckan/lib/search/index.py b/ckan/lib/search/index.py index 5b95ca97058..9ee538518a7 100644 --- a/ckan/lib/search/index.py +++ b/ckan/lib/search/index.py @@ -136,7 +136,7 @@ def index_package(self, if config.get_value('ckan.search.remove_deleted_packages'): # delete the package if there is no state, or the state is `deleted` - if (not pkg_dict.get('state') or 'deleted' in pkg_dict.get('state')): + if pkg_dict.get('state', 'deleted') == 'deleted': return self.delete_package(pkg_dict) index_fields = RESERVED_FIELDS + list(pkg_dict.keys()) diff --git a/ckan/views/admin.py b/ckan/views/admin.py index 957b6731f92..baa19815fea 100644 --- a/ckan/views/admin.py +++ b/ckan/views/admin.py @@ -232,7 +232,9 @@ def purge_all(self): for action, deleted_entities in zip(actions, entities): for entity in deleted_entities: - ent_id = entity.id if hasattr(entity, 'id') else entity['id'] # type: ignore + + ent_id = entity.id if hasattr(entity, 'id') \ + else entity['id'] # type: ignore logic.get_action(action)( {u'user': g.user}, {u'id': ent_id} )