[Zope3-Users] want to use ObjectWidget and default add form

Christophe Combelles ccomb at free.fr
Sat Dec 29 11:46:27 EST 2007


john saponara a écrit :
> hi,
> 
> please point me to an example showing how to use ObjectWidget with a 
> default add form.  in case there is no example, perhaps my failing 
> attempt below could serve as one, once it's modified to work.

[...]

> ComponentLookupError: ((<zope.schema._field.Object object at 
> 0x03584090>, <zope.publisher.browser.BrowserRequest instance 
> URL=http://localhost:2020/mylimo/@@+/action.html>), <InterfaceClass 
> zope.app.form.interfaces.IInputWidget>, u'') 127.0.0.1 - - 

It seems you have no widget associated to your Object field.
You should use less zcml and implement your own addform:

   driver_widget = CustomWidgetFactory(ObjectWidget, Driver)

   class DriverAddForm(AddForm):
     form_fields = Fields(IDriver)
     form_fields['car'].custom_widget = driver_widget
     def __init__(self, context, request):
         (...)
     def create(self.data):
         (...)

Christophe


More information about the Zope3-users mailing list