-
-
Save kindly/9f19fcda5871321335ec to your computer and use it in GitHub Desktop.
Overide logic function example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ckan.plugins import implements, SingletonPlugin, IConfigurable, IActions | |
from ckan.logic.get import vocabulary_show | |
## override the logic function, just add for_view in the context | |
## this will only work for this 'vocabulary show' api call. | |
def my_vocabulary_show(context, data_dict): | |
context['for_view'] = True | |
return vocabulary_show(context, data_dict) | |
class YourExtension(SigletonPlugin): | |
implements(IActions, inherit=True) | |
## the IAction extension returns a dictionary of core actions it wants to override. | |
def get_actions(): | |
return {'vocabulary_show': my_vocabulary_show} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment