Skip to content

Commit

Permalink
[ckan#1200] add loaded plugin logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed Oct 24, 2013
1 parent ca51350 commit f18f76b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion ckan/plugins/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'PluginNotFoundException', 'Plugin', 'SingletonPlugin',
'load', 'load_all', 'unload', 'unload_all',
'get_plugin', 'plugins_update',
'use_plugin',
'use_plugin', 'plugin_loaded',
]

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -210,6 +210,15 @@ def unload(*plugins):
plugins_update()


def plugin_loaded(name):
'''
See if a particular plugin is loaded.
'''
if name in _PLUGINS:
return True
return False


def find_system_plugins():
'''
Return all plugins in the ckan.system_plugins entry point group.
Expand Down
2 changes: 1 addition & 1 deletion ckanext/datastore/logic/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def datastore_create(context, data_dict):

# create resource from file
if has_url:
if not 'datapusher' in pylons.config.get('ckan.plugins', ''):
if not p.plugin_loaded('datapusher'):
raise p.toolkit.ValidationError({'resource': [
'The datapusher has to be enabled.']})
p.toolkit.get_action('datapusher_submit')(context, {
Expand Down

0 comments on commit f18f76b

Please sign in to comment.