From 4801917375332c52a01c26eb5e380a191eb5a0f3 Mon Sep 17 00:00:00 2001 From: Thorge Petersen <petersen@rz.uni-kiel.de> Date: Wed, 12 Jul 2023 13:18:24 +0200 Subject: [PATCH] Deprecated methods replaced with their respective new versions from plugin interfaces --- CHANGELOG.md | 17 +++++++++++++++++ ckanext/odsh/pdf_to_thumbnail/plugin.py | 6 +++--- ckanext/odsh/plugin.py | 8 ++++---- ckanext/odsh/search.py | 2 +- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfa669fd..29b1656a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated minimum CKAN version requirement from `2.9` to `2.10`. Please run `ckan db upgrade` after updating. - Replaced `is_okd_compliant` with `od_conformance` and `is_osi_compliant` with `osd_conformance` in the [licenses.json](./ckanext/odsh/resources/licenses.json) file. +- Deprecated methods replaced with their respective new versions from plugin interfaces: + - `ckan.plugins.interfaces.IResourceController`: + - Replaced `before_create` with `before_resource_create` + - Replaced `after_create` with `after_resource_create` + - Replaced `before_update` with `before_resource_update` + - Replaced `after_update` with `after_resource_update` + - Replaced `before_delete` with `before_resource_delete` + - Replaced `after_delete` with `after_resource_delete` + - Replaced `before_show` with `before_resource_show` + - `ckan.plugins.interfaces.IPackageController`: + - Replaced `after_create` with `after_dataset_create` + - Replaced `after_update` with `after_dataset_update` + - Replaced `after_delete` with `after_dataset_delete` + - Replaced `after_show` with `after_dataset_show` + - Replaced `before_search` with `before_dataset_search` + - Replaced `after_search` with `after_dataset_search` + - Replaced `before_index` with `before_dataset_index` ## [2.1.0] diff --git a/ckanext/odsh/pdf_to_thumbnail/plugin.py b/ckanext/odsh/pdf_to_thumbnail/plugin.py index 3181c396..f0c5f4c0 100644 --- a/ckanext/odsh/pdf_to_thumbnail/plugin.py +++ b/ckanext/odsh/pdf_to_thumbnail/plugin.py @@ -20,15 +20,15 @@ class ThumbnailPlugin(plugins.SingletonPlugin): #IResourceController - def after_create(self, context, resource): + def after_resource_create(self, context, resource): resources = thumbnail.resources_of_containing_package(resource) thumbnail.create_thumbnail_if_none_in_package(context, resources) - def after_update(self, context, resource): + def after_resource_update(self, context, resource): resources = thumbnail.resources_of_containing_package(resource) thumbnail.create_thumbnail_if_none_in_package(context, resources) - def after_delete(self, context, resources): + def after_resource_delete(self, context, resources): thumbnail.create_thumbnail_if_none_in_package(context, resources) #IConfigurer diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py index e02d1151..500edc63 100644 --- a/ckanext/odsh/plugin.py +++ b/ckanext/odsh/plugin.py @@ -252,7 +252,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm # IPackageController - def after_show(self, context, pkg_dict): + def after_dataset_show(self, context, pkg_dict): ''' corrects missing relationships in pkg dict adds the following key-value-pairs to pkg_dict: @@ -274,11 +274,11 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm self._update_is_new_in_pkg_dict(pkg_dict) return pkg_dict - def after_create(self, context, resource): + def after_dataset_create(self, context, resource): if resource.get('package_id'): tools.add_attributes_resources(context, resource) - def after_update(self, context, resource): + def after_dataset_update(self, context, resource): if resource.get('package_id'): tools.add_attributes_resources(context, resource) @@ -287,7 +287,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm is_new = HelperPgkDict(pkg_dict).is_package_new() pkg_dict.update({'is_new': is_new}) - def before_index(self, dict_pkg): + def before_dataset_index(self, dict_pkg): # make special date fields solr conform fields = ["issued", "temporal_start", "temporal_end"] for field in fields: diff --git a/ckanext/odsh/search.py b/ckanext/odsh/search.py index 8d2a794d..86894570 100644 --- a/ckanext/odsh/search.py +++ b/ckanext/odsh/search.py @@ -1,6 +1,6 @@ import ckanext.odsh.helpers as odsh_helpers -def before_search(search_params): +def before_dataset_search(search_params): _update_facet_mincount(search_params) _update_daterange_query(search_params) return search_params -- GitLab