[ckan-dev] Context in record hook

Tyler Kennedy tk at tkte.ch
Wed Sep 5 20:41:35 UTC 2018


Hello Gavin,

Yes it is. If you're doing it after the commit, you'll want to look at the
previous revisions. If you're doing it before the commit, you can just
package_show and you'll get the version before the change has been made.
Take a look at
http://docs.ckan.org/en/ckan-2.7.3/api/#ckan.logic.action.get.package_revision_list
and the related API calls.

This will be *much *simpler in upcoming CKAN versions with David's
fantastic work in https://github.com/ckan/ckan/pull/3972. You'll be able to
get the complete previous version of a dataset at any point in time from
the activity feed.

Thank you,
Tyler Kennedy

On Wed, Sep 5, 2018 at 4:31 PM, Gavin Cannizzaro <gcannizzaro at mindgrub.com>
wrote:

> Hi all,
>
> Is it possible to access the previous version of a record (aka package)
> from an update hook?  For example, if we wanted to take an action based on
> a certain field having changed.
>
> Thanks!
> Gavin
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20180905/64cd565a/attachment-0002.html>


More information about the ckan-dev mailing list