[ckan-dev] Conditional validation on custom Datasets

David Raznick david.raznick at okfn.org
Wed Mar 5 19:47:56 UTC 2014


Hello

This is interesting and I did not know it was so brutal at making sure
you run get_action.  It is only supposed to do this on action
functions that can be called this way (i.e not on core ones that have
been overridden).

Ians suggestion will probably work as you are getting the function
before it has been wrapped with this warn function.

otherwise the following should work, but I do not like it...

def feeder_resource_create(context, data_dict):
    import ckan.logic as logic
    context['schema'] = FeederForm().create_package_schema()
    return logic.action.create.resource_create.__replaced(context, data_dict)

David

On 5 March 2014 17:18, Ian Ward <ian at excess.org> wrote:
> On Wed, Mar 5, 2014 at 11:52 AM, Richard Claydon <richard at icdw.co.uk> wrote:
>>
>> def feeder_resource_create(context, data_dict):
>>     import ckan.logic as logic
>>     context['schema'] = FeederForm().create_package_schema()
>>     return logic.action.create.resource_create(context, data_dict)
>
> Hi Richard,
>
> Try "from ckan.logic.action.create import resource_create as
> original_resource_create" at the module level, then use
> original_resource_create in your function.
>
> Ian
> _______________________________________________
> 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



More information about the ckan-dev mailing list