[ckan-dev] Database hooks (IMapper)

Milo Thurston milo.thurston at oerc.ox.ac.uk
Thu Apr 30 16:36:24 UTC 2015


I’d like to be able to perform some operations on related objects when some are deleted, and it would seem from the documentation that extending IMapper in a plugin is what is required:

http://docs.ckan.org/en/latest/extensions/plugin-interfaces.html

Therefore, I would expect this to work:

import ckan.plugins as plugins

class TeSSPlugin(plugins.SingletonPlugin, toolkit.DefaultDatasetForm):
    plugins.implements(plugins.IMapper, inherit=True)

    def before_delete(self, mapper, connection, instance):
	log(“About to delete: %r", instance)
	# do some stuff here…


However, this code is never called. Is there anything I’m missing here?







More information about the ckan-dev mailing list