[ckan-dev] Problem registering plugin that implements IDatasetForm interface

Haq, Salman Salman.Haq at neustar.biz
Tue Jun 5 20:01:17 UTC 2012


I am working on an extension that has three plugins (DataSourcePlugin, DataSourcePackageController, and DataSourceDatasetForm) that implement various interfaces.
One of those plugins implements the IDatasetForm interface (DataSourceDatasetForm), however it is not being registered with the plugin environment.
I know this for a fact because calling `PluginGlobals.pprint` from inside one of my controller actions pretty prints the list of installed plugins and the plugin in question is not listed.

Snippet from setup.py:

entry_points=\
"""
        [ckan.plugins]
   datasource = ckanext.datasource.plugin:DataSourcePlugin
   datasource_form = ckanext.datasource.forms:DataSourceDatasetForm
   datasource_controller = ckanext.datasource.controller:DataSourcePackageController

""",

And the relevant snippet from ckanext/datasource/forms.py:

class DataSourceDatasetForm (SingletonPlugin, DefaultDatasetForm):

    implements(IDatasetForm, inherit=True)

    def is_fallback(self):
        log.info('is_fallback')
        return True

    def package_types(self):
        log.info('package_types')
        return ["dataset"]

    def setup_template_variables(self, context, data_dict=None):
        log.info('setup_template_variables')
        log.debug(context)
        log.debug(data_dict)
        log.debug(c)

None of above log statements get called at any point.

The full output from PluginGlobals.pprint:

--------------------------------------------------------------
 Registered Environments
--------------------------------------------------------------
 <default>
 pca

--------------------------------------------------------------
 Environment Stack
--------------------------------------------------------------
 Level=1  name=<default>
 Level=2  name=pca

--------------------------------------------------------------
 Interfaces Declared
--------------------------------------------------------------
 IActions
 IAuthFunctions
 IAuthorizer
 IConfigurable
 IConfigurer
 IDatasetForm
 IDomainObjectModification
 IGenshiStreamFilter
 IGroupController
 IGroupForm
 IIgnorePluginWhenLoading
 IMapper
 IMiddleware
 IPackageController
 IPluginLoadPath
 IPluginLoader
 IPluginObserver
 IResourceUrlChange
 IRoutes
 ISession
 ITagController
 ITemplateHelpers

--------------------------------------------------------------
 Registered Plugins by Interface
--------------------------------------------------------------
 IActions
     None

 IAuthFunctions
     None

 IAuthorizer
     None

 IConfigurable
     ArchiverPlugin
     DataSourcePlugin
 IConfigurer
     DataSourcePlugin
     MetaDataHub
     StatsPlugin

 IDatasetForm
     None

 IDomainObjectModification
     ArchiverPlugin
     SynchronousSearchPlugin
     WebstorerPlugin

 IGenshiStreamFilter
     DataSourcePlugin

 IGroupController
     None

 IGroupForm
     None

 IIgnorePluginWhenLoading
     IgnorePluginPlugins
 IMapper
     None

 IMiddleware
     None

 IPackageController
     DataSourcePackageController

 IPluginLoadPath
     None

 IPluginLoader
     None

 IPluginObserver
     None

 IResourceUrlChange
     ArchiverPlugin
     WebstorerPlugin

 IRoutes
     DataSourcePlugin
     StatsPlugin

 ISession
     DomainObjectModificationExtension

 ITagController
     None

 ITemplateHelpers
     None

--------------------------------------------------------------
 Registered Plugins by Python Module
--------------------------------------------------------------
 ckan.lib.search
     SynchronousSearchPlugin

 ckan.model.modification
     DomainObjectModificationExtension

 ckanext.archiver.plugin
     ArchiverPlugin

 ckanext.datasource.controller
     DataSourcePackageController

 ckanext.datasource.plugin
     DataSourcePlugin

 ckanext.datastorer.plugin
     WebstorerPlugin

 ckanext.metadatahub.plugin
     MetaDataHub

 ckanext.stats.plugin
     StatsPlugin

 pyutilib.component.core
     IgnorePluginPlugins

--------------------------------------------------------------
 Services for Registered Environments
--------------------------------------------------------------
 Services for Environment '<default>'
   None

 Services for Environment 'pca'
   <Plugin ArchiverPlugin>  (4*)
   <Plugin DataSourcePackageController>  (9*)
   <Plugin DataSourcePlugin>  (7*)
   <Plugin DomainObjectModificationExtension>  (8*)
   <Plugin MetaDataHub>  (6*)
   <Plugin StatsPlugin>  (3*)
   <Plugin SynchronousSearchPlugin>  (2*)
   <Plugin WebstorerPlugin>  (5*)
--------------------------------------------------------------

Is this enough information to identify that missing link?

Thanks,
Salman



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20120605/09f0c6b7/attachment.html>


More information about the ckan-dev mailing list