[Zope3-Users] Validation of schemas?

Antonio Beamud Montero antonio.beamud at linkend.net
Tue Nov 15 15:03:08 EST 2005


El sáb, 12-11-2005 a las 07:37 -0500, Stephan Richter escribió:
> On Thursday 03 November 2005 08:09, Adam Summers wrote:
> > This will do the validation on add. But how do I get the schema  to be
> > validated on an
> > update to it?
> 
> You could write your own property class that does the invariant checks. See
> 
> zope.schema.fieldproperty.FieldProperty
> 
> In fact, if you feel heroic, you should just add the invariance check to that 
> code and check it in! That would be a great feature.!

If I define a field in a schema like:
groups = List(title=u'Groups',
              default=[],
              description=u'Groups of the contacts',
              value_type=TextLine(title=u"Group"))

and in the class implementing this interface:

groups = FieldProperty(icontact.IContact['groups'])

The problem is how to define that groups is a PersistentList.
If I define the default schema as "default=PersistentList()" an error
happens...

ConfigurationError: ('Invalid value for', 'interface', "([], <type
'list'>)")

Thanks.



More information about the Zope3-users mailing list