[ckan-dev] IActions Interface

Toby Dacre toby.okfn at gmail.com
Tue May 14 09:00:54 UTC 2013


On 13 May 2013 20:10, Dominik Moritz <dominik.moritz at okfn.org> wrote:
> Hi Toby,
>
> On 13 May 2013, at 13:40, Toby Dacre <toby.okfn at gmail.com> wrote:
>
>> Hi,
>>
>> In the datastore the resource_show action is modified to add a couple
>> of extra fields to the resource data dict.  Currently this is done by
>> grabbing the original action function and wrapping it in a new one and
>> then adding this to the actions functions.  This is extremely evil
>> imho as we are using internal private variables to achieve this which
>> should not be done in core let alone in an extension.
>>
>> It does seem to be a legitimate need though.
>>
>> Following discussion with David it feels like the best option may be
>> to add a before_action(action_name, context, data_dict) and
>> after_action(action_name, context, data_dict) methods.  It would be
>> easy to add these and it feels useful. This would also solve a
>> data.gov issue.
>>
>> does anyone have a view on this?
>
> What happens if there are two extensions that define a after_action? I think we should define that everything in after_action and before_action is commutative. The problem is that there is no way for us to make sure that it is, or is there?

it would be like any other interface and the calls would be chained.
We have to trust the plugins a little but no more than elsewhere

>
>> --
>> Toby Dacre
>>
>> The Open Knowledge Foundation
>>
>> Empowering through Open Knowledge
>> http://okfn.org/  |  @okfn
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev



-- 
Toby Dacre

The Open Knowledge Foundation

Empowering through Open Knowledge
http://okfn.org/  |  @okfn




More information about the ckan-dev mailing list