[ckan-dev] customizing model_save.package_dict_save()
Salman.Haq at neustar.biz
Wed Jun 27 20:22:40 BST 2012
(Oops, accidentally hit send. Final email to follow – please ignore previous email).
From: <Haq>, Salman Haq <Salman.Haq at neustar.biz<mailto:Salman.Haq at neustar.biz>>
Reply-To: CKAN Development Discussions <ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>>
To: CKAN Development Discussions <ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>>
Subject: [ckan-dev] customizing model_save.package_dict_save()
My extension introduces new objects in the 'pkg_dict' obtained by parsing the POST params. I want to save these objects in a database table for which I have defined the ORM model similar to the 'resource' table.
The 'pkg_dict' is saved by the function model_save.package_dict_save(). There is no easy way to customize this function. Ideally, I just want to call a new function inside it similar to package_resource_list_save().
Possible options I am debating:
1. Introduce a interface for plugins that wish to implement this kind of behavior.
2. Rely on the existing IPackageController interface, but change the signature of IPackageController.edit so that it accepts the pkg_dict also and have my plugin implement that interface to perform my validation and save logic.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ckan-dev