Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何翻译滤锅验证器的错误消息?文档只是说这是可能的。
def valid_text(node, value): raise Invalid(node, u"Some error message") class form(colander.MappingSchema): name = colander.SchemaNode(colander.String(), validator=valid_text)
我知道变形已经做到了,但我需要自己使用滤锅。
根据API 文档,msg参数 toInvalid可以是翻译字符串实例。有关使用翻译字符串的信息在这里。
msg
Invalid
看起来这个问题已经得到解决和修复,但它将成为下一个版本的一部分。我刚刚添加了来自提交 f6be836的更改,它就像一个魅力。