[Zope3-Users] WrongContainedType
Tim Cook
timothywayne.cook at gmail.com
Sun Nov 23 04:36:17 EST 2008
Just to follow up on this issue. I have created a bug report on
launchpad with a possible fix. However, I do not know for sure that
this doesn't have other negative consequences.
https://bugs.launchpad.net/zope3/+bug/301226
Cheers,
Tim
On Thu, 2008-10-09 at 18:08 -0700, Marius Gedminas wrote:
> On Thu, Oct 09, 2008 at 08:42:21AM -0300, Tim Cook wrote:
> > I am having difficulty understanding this error.
> >
> > It occurs in the call:
> > ontObj.parentArchetype = ObjectRef(oid,u'openehr',u'ARCHETYPE')
> >
> > The first parameter for ObjectRef is declared in the schema as:
> >
> > refId = Object(
> > schema=IObjectId,
> > title = _(u'Id'),
> > description = _(u'Globally unique id of an object (of type
> > ObjectId), regardless of where it is stored.'),
> > required = True
> > )
> >
> > If I print the parameter 'oid' it does correctly report:
> > <oship.openehr.rm.support.identification.objectid.ObjectId object at
> > 0x1b70210>
> >
> > the other two parameters for ObjectRef are declared as TextLines.
> >
> > The traceback is:
> > zope.schema.interfaces.WrongContainedType: [, []]
>
> Oh dear. That's one of the worst error messages I've seen.
>
> > What I do not understand is how to interpret the [, []]
>
> By reading the source code.
>
> Object field validation actually attempts to validate the schema
> (IObjectId in this case) of the object you're trying to store (the
> ObjectId object, in this case). If any of the fields cannot be
> validated during this nested validation, you get a WrongContainedType
> with the list of errors (one for each field).
>
> Apparently those errors have horrible __repr__s. That ought to be
> fixed.
>
> > I'm not passing a list nor is the schema using a list.
> >
> > I realize that this may be pretty basic but I am missing something in
> > reading the error.
>
> I'd put a breakpoint in zope.schema._field, specifically, in
> Object._validate, and try to see what's wrong by single-stepping.
>
> Marius Gedminas
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
--
Timothy Cook, MSc
Health Informatics Research & Development Services
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
Skype ID == timothy.cook
**************************************************************
*You may get my Public GPG key from popular keyservers or *
*from this link http://timothywayne.cook.googlepages.com/home*
**************************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oe_trick.png
Type: image/png
Size: 7092 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20081123/ff4a5c7a/attachment.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20081123/ff4a5c7a/attachment.bin
More information about the Zope3-users
mailing list