1

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.

Ander
  • 5,093
  • 7
  • 41
  • 70

2 Answers2

1

According to the API documentation, the msg argument to Invalid can be a translation string instance. Information on working with translation strings is here.

Vaibhav Sagar
  • 2,208
  • 15
  • 21
1

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.

Ander
  • 5,093
  • 7
  • 41
  • 70