[Zope3-Users] "Wrong contained type" - why?

Hermann Himmelbauer dusty at qwer.tk
Fri Apr 27 03:22:04 EDT 2007


Am Donnerstag, 26. April 2007 18:50 schrieb Rupert Redington:
> Hermann Himmelbauer wrote:
> > Hi,
> > As already mentioned before, I use interfaces that contain lists of other
> > interfaces via the following syntax:
> >
> > emails = List(value_type=Object(schema=IEmail))
> >
> > In my formlib-based class, I have use the following, so that the widgets
> > are displayed correctly:
> >
> > email_widget = CustomWidgetFactory(ObjectWidget,Email)
> > emails_widget = CustomWidgetFactory(ListSequenceWidget,
> > subwidget=email_widget)
> >
> > and in the form.Form based class:
> >
> > form_fields['emails'].custom_widget = emails_widget
> >
> > The widgets are displayed perfectly, but when I try to update the data,
> > the validation fails with the following error:
> >
> > "Wrong contained type"

Well, I found the error myself - and it was very silly, therefore I did not 
post a solution: My class which implemented the interface, was declared 
twice, the second overwrote the first one and missed the "implements()" 
statement.

So the very simple problem was that my object did not implement the interface.

It's still my big problem that I need a long, long time to decipher various 
errors thrown by Zope3. In this special case I had to look through the 
formlib/schema source code, which is not easily understandable to me due to 
the interface/adapter patterns, which still leave me puzzled in various 
cases...

Regards,
Hermann

-- 
x1 at aon.at
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7


More information about the Zope3-users mailing list