diff --git a/ckanext/qa/plugin.py b/ckanext/qa/plugin.py index b071ad52..7f74a98c 100644 --- a/ckanext/qa/plugin.py +++ b/ckanext/qa/plugin.py @@ -65,17 +65,28 @@ def register_reports(self): # IActions def get_actions(self): - return get_functions(action) + return { + 'qa_resource_show': action.qa_resource_show, + 'qa_package_openness_show': action.qa_package_openness_show, + } # IAuthFunctions def get_auth_functions(self): - return get_functions(auth) + return { + 'qa_resource_show': auth.qa_resource_show, + 'qa_package_openness_show': auth.qa_package_openness_show, + } # ITemplateHelpers def get_helpers(self): - return get_functions(helpers) + return { + 'qa_openness_stars_resource_html': + helpers.qa_openness_stars_resource_html, + 'qa_openness_stars_dataset_html': + helpers.qa_openness_stars_dataset_html, + } # IPackageController @@ -102,10 +113,3 @@ def after_show(self, context, pkg_dict): del qa_dict['package_id'] del qa_dict['resource_id'] res['qa'] = qa_dict - - -def get_functions(module): - return dict((name, function) for name, function - in module.__dict__.items() - if isinstance(function, types.FunctionType) - and name[0] != '_')