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

Sean Hammond sean.hammond at okfn.org
Wed Jun 6 09:31:29 UTC 2012


Have you enabled your plugin in your ini file (e.g. development.ini)?

On Tue, Jun 05, 2012 at 04:01:17PM -0400, Haq, Salman wrote:
> 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
> 
> 
> 

> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev





More information about the ckan-dev mailing list