On Fri, Oct 10, 2008 at 06:19:48PM +0200, Roger Ineichen wrote: > Hi Tim > > > Betreff: Re: AW: [Zope3-Users] WrongContainedType > > > > On Fri, 2008-10-10 at 17:46 +0200, Roger Ineichen wrote: > > > > > I guess not, normaly such an error has an empty > > representation and the > > > list is not empty. Try to do errors or type(errors) and you > > > probably see something. > > > > > > If not I'm confused > > > > Well, I'm confused anyway, but that isn't difficult. ;-) > > > > After commenting the the if test on errors and the raise. > > > > With print 'Object schema validation errors=',type(errors): > > I get: > > Object schema validation errors= > > <class'zope.schema._bootstrapinterfaces.RequiredMissing'> > > Object schema validation errors= > > <class'zope.schema._bootstrapinterfaces.RequiredMissing'> > > > > With print 'Object schema validation errors=',errors: > > I get: > > just the string Object schema validation errors= printed on each line. > > > > With print 'Object schema validation errors=',errors: > > I get: > > Object schema validation errors=  > > Object schema validation errors= 
That's because RequiredMissing subclasses ValidationError, which defines def __repr__(self): return ' '.join(map(str, self.args)) That's bad code! No cookie! If you do print [RequiredMissing()] you will see  which is not distinguishable from an empty list. Things to fix: * ValidationError's __repr__ should consider the corner case when self.args is empty and return, say, self.__doc__. * the piece of code that raises RequiredMissing should always supply some arguments (at the very least, the name of the field with the missing value) > The error (probably, not sure) means that the object you > like to store has a missing value. Can you check the > schema of this object and set required=False in all fields? > > If there is a problem, can you post the interface and class > of this object as a sample? And probably the code which > tries to store the object. That is the correct path to fixing Tim's problem, but I think we should fix Zope as well. Marius Gedminas -- I used to be an agnostic, but now I'm not so sure.
Description: Digital signature
_______________________________________________ Zope3-users mailing list Zope3firstname.lastname@example.org http://mail.zope.org/mailman/listinfo/zope3-users