[Grok-dev] schema.Object

Sascha Boch sascha.boch at gmx.de
Wed Jul 21 09:04:15 EDT 2010


Ok, still no joy. The form is rendered fine but the "Fields: Object is of 
wrong type." keeps coming. Here's the 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 FooField(grok.Model):
    grok.implements(IFooField)
    name = FieldProperty(IFooField['name'])
    label = FieldProperty(IFooField['label'])
    format = FieldProperty(IFooField['format'])
   
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, 
        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''
    
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')    
-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20100721/d25ac3e0/attachment.html 


More information about the Grok-dev mailing list