[ckan-dev] CKAN API with fluent/scheming

Stéphane Lapointe lapointes at ogsl.ca
Thu Mar 16 20:38:32 UTC 2017


Hi,

I'm trying to use the plugin fluent/scheming with CKAN API

First, I've configured and installed the plugins and defined a json 
scheming. Everything seems to work fine when I'm using the UI: dataset 
is created with title in [fr] and [en], and title switch when I swicth 
UI language.
Even more, I can update the dataset with CKAN API.

The problems appears when I try to update a dataset AFTER creating it 
from CKAN API. I've noticed that the dataset create with CKAN API 
doesn't insert title_translated even if it's defined.
Also, I've notice that package_show returns extras[], which are not 
defined anywhere, and I don't know why.

Here's my code who doesn't generate errors (httpd logs is clean too)

         try:
             kwargs = {'id': data_dict['name']}
             package_dict = ckanremote.action.package_show(**kwargs)
         except NotFound:
             pass
         except:
             print "Unexpected error:", sys.exc_info()[0]
             raise

         try:
             if package_dict:

                 (some updates - package_dict is updated with values of 
data_dict)

                 response_dict = 
ckanremote.action.package_update(**package_dict)
             else:
                 response_dict = 
ckanremote.action.package_create(**data_dict)
         except:

Here's the values I'm trying to insert/update


     {
         "name": "ismer",
         "title": "Institut des sciences de la mer de Rimouski",
         "description": "L'ISMER, centre de recherche en science de la 
mer affilié à l'Université du Québec à Rimouski (UQAR), possède 
plusieurs infrastructures de recherche lui permettant de se positionner 
comme chef de file dans le vaste domaine des sciences de la mer.",
         "image_url": 
"https://ogsl.ca/commons/projet/ckan/logo/UQAR-ISMER.png",
         "state": "active",
         "packages": [
             {
                 "name": "91585822-20d9-422b-a1d7-e90a58174cb9",
                 "title": "Courants de surface en temps réel mesurés par 
radars hautes-fréquences dans l'estuaire",
                 "title_translated": {
                     "fr": "Courants de surface en temps réel mesurés 
par radars hautes-fréquences dans l'estuaire",
                     "en": "Real-time surface currents measured by 
high-frequency radars in the eatuary"
                 },
                 "author": "Institut des sciences de la mer de Rimouski",
                 "author_email": "",
                 "maintainer": "Dany Dumont, Cédric Chavanne",
                 "maintainer_email": 
"dany_dumont at uqar.ca;cedric_chavanne at uqar.ca",
                 "license_id": "other-open",
                 "notes": "some notes",
                 "url": "",
                 "version": "",
                 "state": "active",
                 "type": "",
                 "resources": [],
                 "relationships_as_object": "",
                 "relationships_as_subject": "",
                 "groups": "",
                 "owner_org": ""
             }
         ],
         "users": ""
     }

Am I missing something?

Thank you.





More information about the ckan-dev mailing list