diff --git a/ckan/logic/action/get.py b/ckan/logic/action/get.py index 146cd899b86..cb8ffc8b8bf 100644 --- a/ckan/logic/action/get.py +++ b/ckan/logic/action/get.py @@ -1167,7 +1167,10 @@ def package_search(context, data_dict): package_dict = json.loads(package_dict) if context.get('for_view'): for item in plugins.PluginImplementations( plugins.IPackageController): - package_dict = item.before_view(package_dict) + # NOTE: Prior to ckan 2.0 before_view() was called + # but this behaviour has been changed to improve + # performance. + package_dict = item.before_search_view(package_dict) results.append(package_dict) else: results.append(model_dictize.package_dictize(pkg,context)) diff --git a/ckan/plugins/interfaces.py b/ckan/plugins/interfaces.py index bde61f934a6..7e696c4fdef 100644 --- a/ckan/plugins/interfaces.py +++ b/ckan/plugins/interfaces.py @@ -315,6 +315,14 @@ def before_view(self, pkg_dict): ''' return pkg_dict + def before_search_view(self, pkg_dict): + ''' + Extensions will recieve this before the dataset gets + displayed in the search view. The dictionary passed will + be the one that gets sent to the template. + ''' + return pkg_dict + class IPluginObserver(Interface): """