[Zope3-Users] WrongContainedType

Tim Cook timothywayne.cook at gmail.com
Fri Oct 10 13:01:23 EDT 2008


Thanks for your help Roger,

On Fri, 2008-10-10 at 18:19 +0200, Roger Ineichen wrote:
> 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?
> 

Did that in both schemas on my local copy and no change.
I just did a new commit to the svn prior to this email. 

> 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.

The code for these are quite verbose and will certainly obscure the
commentary so I hope it's okay that I post links to the SVN within the
comments?

The failing code is when building an ArchetypeOntology class:
http://www.openehr.org/svn/ref_impl_python/TRUNK/oship/src/oship/openehr/am/archetype/ontology/archetypeontology.py 

Interface:
http://www.openehr.org/svn/ref_impl_python/TRUNK/oship/src/oship/openehr/am/archetype/ontology/interfaces/archetypeontology.py 

The builder code for this is here:
http://www.openehr.org/svn/ref_impl_python/TRUNK/oship/src/oship/atbldr/bldontolgy.py 

It is failing when I try to assign the the value for the parentArchetype
attribute.  Here's the traceback:

*************************************************************************************
Traceback (most recent call last):
  File "load_ar.py", line 182, in <module>
    CreateAT()
  File "/home/tim/oshipenv/oship/src/oship/atbldr/atbldr.py", line 142,
in CreateAT
    bldArchetype(parsed_adl)  
  File "/home/tim/oshipenv/oship/src/oship/atbldr/atbldr.py", line 175,
in bldArchetype
    ontology=bldOntology(parsed_adl)
  File "/home/tim/oshipenv/oship/src/oship/atbldr/bldontolgy.py", line
47, in bldOntology
    ontObj.parentArchetype = ObjectRef(oid,u'openehr',u'ARCHETYPE')
  File
"/home/tim/.buildout/eggs/zope.schema-3.4.0-py2.5.egg/zope/schema/fieldproperty.py", line 52, in __set__
    field.validate(value)
  File
"/home/tim/.buildout/eggs/zope.schema-3.4.0-py2.5.egg/zope/schema/_bootstrapfields.py", line 138, in validate
    self._validate(value)
  File
"/home/tim/.buildout/eggs/zope.schema-3.4.0-py2.5.egg/zope/schema/_field.py", line 469, in _validate
    raise WrongContainedType(errors)
zope.schema.interfaces.WrongContainedType: [, []]
*************************************************************************************

In the builder code you can see that oid is an instance of ObjectID.
That seems to work okay.  ObjectRef has three attributes, the first an
instance of ObjectId, the second two are TextLines. 

http://www.openehr.org/svn/ref_impl_python/TRUNK/oship/src/oship/openehr/rm/support/identification/objectref.py 

Interface:
http://www.openehr.org/svn/ref_impl_python/TRUNK/oship/src/oship/openehr/rm/support/identification/interfaces/objectref.py 

The ObjectId class and interface are in the same package if you want to
look at them.


Thanks,
Tim






-- 
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: 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/20081010/fbc41ae5/attachment.bin 


More information about the Zope3-users mailing list