[Zope3-dev] Re: Add function for schema validation in zope.schema

Benji York benji at zope.com
Mon Aug 20 10:12:51 EDT 2007


Philipp von Weitershausen wrote:
> This is exactly what I would suggest: The function should return a list 
> of validation errors. Similar semantics are used in zope.formlib's 
> validate() method. I agree with Wichert's objection about being a bit 
> confusing, though. Perhaps a better name than "validateSchema" could 
> solve this problem, though I can't think of a good one right now... 
> getValidationErrors() seems to naive...

I feel myself slipping into a bikeshed, so this may be my last comment 
on this.

I like "getValidationErrors".  It's use would probably normally look 
something like this:

errors = getValidationErrors(...)
if errors:
     ...

or:

errors = getValidationErrors(...)
if not errors:
     ...

Both look good to me.
-- 
Benji York
Senior Software Engineer
Zope Corporation


More information about the Zope3-dev mailing list