[ckan-dev] Adding a tag to a package

Alan Tygel alantygel at gmail.com
Thu Aug 13 12:12:17 UTC 2015


Hi,

I'm trying to add a tag to a package, but something is going wrong.
Following the documentation, my strategy was:

# take the package data_dict
dataset = p.toolkit.get_action('package_show')({},{'id': ds['id'] })

# append a new tag
dataset['tags'].append(p.toolkit.get_action('tag_show')({},{'id':request.POST['tag1']}))

# update the package
p.toolkit.get_action('package_update')({},{'id':dataset['id'],
'tags':dataset['tags']})

I actually succeeded in adding the new tag, but after this operation the
package resources don't show any more.

I appreciate any hints! And as soon as I fix this, I'll write about in the
docs.

all the best,
alan






-- 
Programa de Pós-Graduação em Informática - PPGI/UFRJ
EITA - Educação, Informação e Tecnologias para Autogestão
Núcleo de Solidariedade Técnica - Soltec/UFRJ <http://www.soltec.ufrj.br>
http://www.cirandas.net/alantygel
http://www.contraosagrotoxicos.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20150813/2dea2116/attachment-0002.html>


More information about the ckan-dev mailing list