[ckan-dev] package_update throws error when adding extra field

Sean Hammond sean.hammond at okfn.org
Fri Feb 1 14:02:02 UTC 2013


> I'm developing a custom controller, which is using the CKAN Action-API
> to manipulate datasets.  First I fetch the dataset with
> 
> dataset = get_action('package_show')(context, {'id': id})
> 
> then I add something to the extras field:
> 
> dataset['extras'].append({'value': 'test', 'key': 'new'})
> 
> Finally I try to save it with:
> 
> result  =  get_action('package_update')(context, dataset)
> 
> Unfortunately I receive an error: IndexError: list index out of range
> It seems that the unflatten method has a problem with my new extra
> field.

That's interesting. What version of CKAN are you using? And can you send
us your CKAN extension, or a mock extension that demonstrates the error
(e.g. post it to github)? That would make it easier for me to reproduce
the problem and investigate.




More information about the ckan-dev mailing list