From 3681c587f4a10de6dd49b8db86d10a59bea85486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aitor=20Mag=C3=A1n?= Date: Wed, 8 Apr 2015 14:34:35 +0200 Subject: [PATCH] Minor improvement. Ensure backwards compatibility --- ckanext/privatedatasets/plugin.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ckanext/privatedatasets/plugin.py b/ckanext/privatedatasets/plugin.py index 00680df..584d0da 100644 --- a/ckanext/privatedatasets/plugin.py +++ b/ckanext/privatedatasets/plugin.py @@ -108,11 +108,18 @@ class PrivateDatasets(p.SingletonPlugin, tk.DefaultDatasetForm): ###################################################################### def get_auth_functions(self): - return {'package_show': auth.package_show, - 'package_update': auth.package_update, - # 'resource_show': auth.resource_show, - constants.PACKAGE_ACQUIRED: auth.package_acquired, - constants.ACQUISITIONS_LIST: auth.acquisitions_list} + auth_functions = {'package_show': auth.package_show, + 'package_update': auth.package_update, + # 'resource_show': auth.resource_show, + constants.PACKAGE_ACQUIRED: auth.package_acquired, + constants.ACQUISITIONS_LIST: auth.acquisitions_list} + + # resource_show is not required in CKAN 2.3 since it delegates in + # package_show + if tk.check_ckan_version(max_version='2.2'): + auth_functions['resource_show'] = auth.resource_show + + return auth_functions ###################################################################### ############################ ICONFIGURER #############################