[Grok-dev] schema.Object
Sascha Boch
sascha.boch at gmx.de
Wed Jul 21 07:10:27 EDT 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20100721/fbec9fa7/attachment.html
More information about the Grok-dev
mailing list