[Zope3-Users] Object Widgets

Marco Mariani marco at sferacarta.com
Tue Apr 18 10:44:03 EDT 2006


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?



Thanks




[...]

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

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

    photo = Object(
        title=_(u"Photo"),
        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__
    self._setUpWidgets()
  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
    context=context)
  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 URL=http://localhost:8080/++skin++Debug/pizzazz/@@contents.html>),
                        <InterfaceClass zope.app.form.interfaces.IInputWidget>, u'')








More information about the Zope3-users mailing list