[ckan-dev] IDatasetForm: form_to_db_schema_api_create() etc

Ian Ward ian at excess.org
Fri Mar 15 17:21:38 UTC 2013


> On 15 March 2013 15:51, Sean Hammond <sean.hammond at okfn.org> wrote:
>> If we're gonna break backward-compatibility here 2.0 seems like the time
>> to do it, anyone with an IDatasetForm plugin is already gonna have to
>> rewrite all their template customizations anyway.

Is there a reason that the db_to_form and form_to_db schemas are
stored separately, other than because that's what navl needs?

Wouldn't it be nice to define the validation and conversions in both
directions in a single place?

e.g.
{
  'dietary_preference': (
    [ignore_missing, unicode, convert_to_extras],
    [convert_from_extras, ignore_missing]),
  'country_code': (
    [convert_to_tags('country')], [convert_from_tags('country')]),
  ...
}

then common patterns could be put into functions that return the tuple
of form_to_db and db_to_form conveters+validators, and adding new
fields can be done in one less place.




More information about the ckan-dev mailing list