Wichert Akkerman wrote:
That would be confusing though: I would expect the result of a method
that checks validaty to return something that evaluates to True if
everything is valid. Code like this just messes up my brain:
if not zope.schema.validate(obj, IMySchema):
print "Everything validates correctly!"
to me that is very non-intuitive and looks like the if condition is
Agreed. I prefer to name boolean methods with an "is" prefix. Then we
if zope.schema.isValid(obj, IMySchema):
if not zope.schema.isValid(...):
That doesn't give any information about what is invalid though, I'd use
a separate method for that. Perhaps something like "getValidationErrors".
Senior Software Engineer
Zope3-dev mailing list