I'm trying to add an image field to the Recipe interface, but I don't know how to bind the "photo" attribute to the image widget.

From reading the docs, I thought it was enough to specify the schema in the Object() field.

I'm using Recipe because it's a well known example application, but I'd like to use formlib instead.
Should I set form_fields['photo'].custom_widget ? To what?



from zope.schema import Object
from zope.app.file.interfaces import IImage

class IRecipe(Interface):
   """Store information about a recipe.

   photo = Object(
       description=_(u"Image of the dish"),
       schema = IImage


The following is raised upon trying to add a Recipe:

 Module zope.interface.adapter, line 475, in queryMultiAdapter
   return factory(*objects)
 Module zope.app.form.browser.editview, line 64, in __init__
 Module zope.app.form.browser.add, line 49, in _setUpWidgets
   setUpWidgets(self, self.schema, IInputWidget, names=self.fieldNames)
 Module zope.app.form.utility, line 153, in setUpWidgets
 Module zope.app.form.utility, line 97, in setUpWidget
   widget = _createWidget(context, field, viewType, view.request)
 Module zope.app.form.utility, line 65, in _createWidget
   return zapi.getMultiAdapter((field, request), viewType)
 Module zope.component, line 154, in getMultiAdapter
   raise ComponentLookupError(objects, interface, name)
ComponentLookupError: ((<zope.schema._field.Object object at 0xb437c80c>,
                       <zope.publisher.browser.BrowserRequest instance 
                       <InterfaceClass zope.app.form.interfaces.IInputWidget>, 

Zope3-users mailing list

Reply via email to