[ckan-dev] Schema "tree-like" update

Ian Ward ian at excess.org
Fri Dec 19 12:42:42 UTC 2014


The fluent and repeating extensions use the new IValidator interface
that's coming in 2.3 to share validaors, but for 2.2 and earlier you
should be able to just import (or even copy) the code into your own
extension instead.

On Fri, Dec 19, 2014 at 6:28 AM, Funquist Tomas <tomas.funquist at smhi.se> wrote:
> Hi!
> Thanks for the answer. The plugins you describe, they all need ckan 2.3? When is that version going to be a "stable" version for production environments?
> /Tomas
>
> -----Ursprungligt meddelande-----
> Från: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] För Ian Ward
> Skickat: den 18 december 2014 16:38
> Till: CKAN Development Discussions
> Ämne: Re: [ckan-dev] Schema "tree-like" update
>
> On Thu, Dec 18, 2014 at 8:51 AM, Funquist Tomas <tomas.funquist at smhi.se> wrote:
>> Hello!
>
> Hello Tomas,
>
> Yes it is possible, but you have to handle making your tree-like objects flat for storing in the DB and you need to accept a flat representation if you want to be able to update them from the dataset editing form.
>
>>
>> Is it in a plugin possible to update the schema to have “tree-like”
>> structure like eg:
> [...]
>>
>>         “accessconstraint": [
>>
>>                "Pending Patent",
>>
>>               "Trademark"
>>
>>         ],
>
> ckanext-repeating[1] has validators[2] you can use for lists of strings.
>
> [1]: https://github.com/open-data/ckanext-repeating
> [2]: https://github.com/open-data/ckanext-repeating/blob/master/ckanext/repeating/validators.py
>
> [...]
>>
>>         "geographics": {
>>
>>              "north":  “90”,
>>
>>             "south":  “90”,
>>
>>             "west":  “90”,
>>
>>             "east":  “90”
>>
>>         },
>
> ckanext-fluent[3] uses dicts for different language versions, so you could write something similar to its validators[4] for your schema.
>
> [3]: https://github.com/open-data/ckanext-fluent/
> [4]: https://github.com/open-data/ckanext-fluent/blob/master/ckanext/fluent/validators.py
>
> [...]
>>         "contact": {
>>
>>              "name": “Arne Weise”,
>>
>>             "orgname": “SVT”,
>>
>>             "role": "author",
>>
>>             "email": [
>>
>>a at b.se",
>>
>>                "c at d.se"
>>
>>             ]
>
> Again, you would need a pair of custom validators for more interesting nested objects like this, but it can be done.
>
> There is also someone working on a more advanced way of specifying metadata schemas based on zope schemas. When that's released as a separate extension that might be a really good fit for what you want.
>
> 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
> _______________________________________________
> 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