[Grok-dev] schema.Object

Souheil CHELFOUH trollfot at gmail.com
Wed Jul 21 07:48:38 EDT 2010


Give us the code of FooField too

2010/7/21 Sascha Boch <sascha.boch at gmx.de>:
> Ok, here's the relevant code:
>
> class IFooField(interface.Interface):
>     name = schema.TextLine(title=u'Name', required = True)
>     label = schema.TextLine(title=u'Label', required = True)
>     format = schema.Choice(title=u'Field Format', required = True, values =
> ['Text', 'Date', 'Number'])
>
> class IFoo(interface.Interface):
>     title=schema.TextLine(title=u'Title',required=True)
>     description=schema.TextLine(title=u'Description',required=False)
>     data_fields_ext = schema.List(title=u'Fields', required = False, unique
> = True, constraint = check_df,
>         value_type = schema.Object(title=u'Field', required = False, schema
> = IFooField))
>
> class Foo(grok.Application, grok.Container):
>     grok.implements(IFoo)
>     title = u'Foobar'
>     description = u''
>     data_fields_ext = None
>
> class FooEditForm(grok.EditForm):
>     grok.context(Foo)
>     grok.name('admin')
>
>     form_fields = grok.AutoFields(Foo)
>     object_widget = CustomWidgetFactory(ObjectWidget, FooField)
>     form_fields['data_fields_ext'].custom_widget =
> CustomWidgetFactory(SequenceWidget, subwidget=object_widget)
>     template = grok.PageTemplateFile('custom_edit_form.pt')
>
> The widgets render fine, but if I click the Apply button, I get the
> following:
>
> There were errors
>
> Fields: Object is of wrong type.
>
> I am not sure how I can debug this. I would really appreciate any further
> advice.
>
> Regards,
> Sascha
>
>
> --
> GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.
> Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
>
>


More information about the Grok-dev mailing list