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

Jim Fulton jim at zope.com
Mon Aug 20 10:55:58 EDT 2007


On Aug 20, 2007, at 7:48 AM, Christian Zagrodnick wrote:

> Hi,
>
> zope.schema defines how a schema can be validated, defines errors  
> and provides a way to validate single fields.
>
> I think we should add a function to validate a given schema on a  
> given class. This should include constraints and invariants:
>
> validateSchema(IMySchema, myobject)  [or alike]
>
> I'm not sure about return values or exceptions. There are different  
> use cases:
>
> 1. Is the object valid? -> True/False
> 2. What's wrong with the object -> {attribute/field-name: what's  
> wrong}, what's wrong with invariants.
>
> Comments?

I remember discussing this a year or more ago.  I don't remember where.

I'd like to see this fit into the zope.interface.verify "framework".   
I'd like to see the verify module refactored to be pluggable and I'd  
like to see schema versification plug into this.  This would *also*  
motivate (or at least enable) people to do better method verification  
and possibly provide other kinds of verification.

Jim

--
Jim Fulton			mailto:jim at zope.com		Python Powered!
CTO 				(540) 361-1714			http://www.python.org
Zope Corporation	http://www.zope.com		http://www.zope.org





More information about the Zope3-dev mailing list