[ckan-dev] Convert a dictionary to/from extras
Stefan Oderbolz
stefan.oderbolz at liip.ch
Mon Mar 3 17:02:55 UTC 2014
Hi Khalegh,
the extras are actually a list of tupels, each tupel has two entries, the
first is the key and the second one is the value.
To convert a dict to a list of tupels, you can use the items() method (see
this answer on StackOverflow for details: http://stackoverflow.com/a/674531)
And here is an actual example how to add an extra field ("license_url"):
https://github.com/ogdch/ckanext-zhgis/blob/develop/ckanext/zhgis/harvesters/zhgisharvester.py#L353
Regards Stefan
On Mon, Mar 3, 2014 at 5:45 PM, Khalegh Mamakani <
khalegh at highwaythreesolutions.com> wrote:
> Hi everybody,
>
> I want to add a dictionary of data like contacts : {'name' : ...., 'email' :
> ...} to a dataset.
> Does anybody know how to define dataset schema so that I can convert the
> dictionary data to extras and when showing the dataset convert it from
> extras?
>
> Thanks,
> Khalegh
> _______________________________________________
> 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
>
--
Liip AG // Feldstrasse 133 // CH-8004 Zurich
Tel +41 43 500 39 80 // GnuPG 0x7B588C67 // www.liip.ch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140303/ad330883/attachment-0003.html>
More information about the ckan-dev
mailing list