[ckan-dev] validation library and deform.

David Raznick kindly at gmail.com
Sun Apr 3 11:01:37 UTC 2011


On Sun, Apr 3, 2011 at 8:49 AM, Friedrich Lindenberg <
friedrich.lindenberg at okfn.org> wrote:

> Hi,
>
> just to say: following the "CKAN will use colander" announcement,
> WDMMG is now also using it to do forms. In the few things we've done
> so far it has been an excellent experience, the documentation is a
> great help and we're planning to switch internal validation (data
> loading) to it as well. We also have some simple recipies for error
> reporting and form-filling.
>
>
Thanks for the feedback and just the person I wanted to ask something of.

I am looking into i18n stuff at the moment.

I was hoping to use some built in validators however Colander only has these
translations.
https://github.com/Pylons/colander/tree/master/colander/locale

I also can't find a way to pass custom messages or custom "translators" to
colander.  This worries me as the built in "SchemaNodes" have types (int,
string) and if these types throw an "Invalid" it can only throw them in
the languages supported.  This means we will have to effectively subclass
all of colanders "SchemaTypes" and rewrite parts of them.

The only library that does this well is formencode (mainly as it by far the
most mature).  It has
https://bitbucket.org/ianb/formencode/src/703c27be52b8/formencode/i18n/
translations.
 Each translation is much more thorough too as formencode has lots of
validators.   My library can easily reuse formencode validators for this
purpose.  You can also pass on your own translator (_, ugettext) if you
like.

What approach would you take to doing this using colander?  Have I missed
something?

Thanks

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20110403/958f9efa/attachment-0001.html>


More information about the ckan-dev mailing list