[ckan-discuss] Architecture Best Practice

Adrià Mercader adria.mercader at okfn.org
Mon Apr 29 11:52:22 BST 2013


(Sorry, sent the email before finishing it)

Hi Marina,

On 28 April 2013 12:07, Marina S. Martin <marina at marinamartin.com> wrote:
> Speaking of validation, is there any documentation I'm missing on
> validators.py? I couldn't quite tell how those validations are currently
> being called. (For example I tried to work backwards in the code how default
> CKAN stops you if you try to enter a name under 2 characters for a dataset,
> but I couldn't clearly find where it was being called.)

CKAN defines different schemas [1] for the different domain objects:
datasets (called packages in the code for historical reasons),
reosurces, users, etc. These schemas define the different validators
that are applied to each field. For instance, the validators for the
dataset name are set here:

https://github.com/okfn/ckan/blob/master/ckan/logic/schema.py#L122

Schemas are used by functions in the logic layer (eg
ckan/logic/action/create.py) to perform the actual operations.

You can modify these validators/converters for existing or new fields
on extensions via the IDatasetForm interface, as you already know.


Adrià



More information about the ckan-discuss mailing list