Skip to content

Commit

Permalink
Add before_search_view() to IPackageController interface
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Nov 26, 2012
1 parent 5c62d60 commit 0b15c36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ckan/logic/action/get.py
Expand Up @@ -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))
Expand Down
8 changes: 8 additions & 0 deletions ckan/plugins/interfaces.py
Expand Up @@ -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):
"""
Expand Down

0 comments on commit 0b15c36

Please sign in to comment.