python-3.xcolander

How to translate error messages in Colander


How can I translate the error messages from the colander validators? The documentation just says that it's possible.

def valid_text(node, value):
        raise Invalid(node, u"Some error message")

class form(colander.MappingSchema):
    name = colander.SchemaNode(colander.String(), validator=valid_text)

I know that deform does it already but I need to use colander on his own.


Solution

  • Looks like this issue was already addressed and fixed, but it will be part of the next release. I've just added the changes from commit f6be836 and it works like a charm.