hi there

here's a smaller, hopefully more clearer example of a problem I have been stuck on. I should probably also lead off by saying that I think what I am asking is basically this question.


However I have read objectwidget.txt( http://svn.zope.org/Zope3/trunk/ src/zope/app/form/browser/objectwidget.txt ) several times and I don't see where a "custom widget" gets created. I also suspect that because the "object" I need to create a custom widget for has more than just one field I have to do something different.

If there's a short fix for the problem that would be great, otherwise a little explanation to point me in the right direction would be greatly appreciated too.



Here's the error I'm getting any my code:

2006-05-11T11:56:47 ERROR SiteError http://localhost:8080/@@+/ action.html
Traceback (most recent call last):
File "/usr/local/Zope-3.2.1/lib/python/zope/publisher/publish.py", line 138, in publish
    result = publication.callObject(request, object)
File "/usr/local/Zope-3.2.1/lib/python/zope/app/publication/ zopepublication.py", line 161, in callObject
    return mapply(ob, request.getPositionalArguments(), request)
File "/usr/local/Zope-3.2.1/lib/python/zope/publisher/publish.py", line 113, in mapply
    return debug_call(object, args)
File "/usr/local/Zope-3.2.1/lib/python/zope/publisher/publish.py", line 119, in debug_call
    return object(*args)
File "/usr/local/Zope-3.2.1/lib/python/zope/app/container/browser/ adding.py", line 128, in action
    name=view_name) is not None:
File "/usr/local/Zope-3.2.1/lib/python/zope/component/ __init__.py", line 165, in queryMultiAdapter return sitemanager.queryMultiAdapter(objects, interface, name, default) File "/usr/local/Zope-3.2.1/lib/python/zope/component/site.py", line 75, in queryMultiAdapter
File "/usr/local/Zope-3.2.1/lib/python/zope/interface/adapter.py", line 475, in queryMultiAdapter
    return factory(*objects)
File "/usr/local/Zope-3.2.1/lib/python/zope/app/form/browser/ editview.py", line 64, in __init__
File "/usr/local/Zope-3.2.1/lib/python/zope/app/form/browser/ add.py", line 49, in _setUpWidgets setUpWidgets(self, self.schema, IInputWidget, names=self.fieldNames) File "/usr/local/Zope-3.2.1/lib/python/zope/app/form/utility.py", line 153, in setUpWidgets
File "/usr/local/Zope-3.2.1/lib/python/zope/app/form/utility.py", line 97, in setUpWidget
    widget = _createWidget(context, field, viewType, view.request)
File "/usr/local/Zope-3.2.1/lib/python/zope/app/form/utility.py", line 65, in _createWidget
    return zapi.getMultiAdapter((field, request), viewType)
File "/usr/local/Zope-3.2.1/lib/python/zope/component/ __init__.py", line 154, in getMultiAdapter
    raise ComponentLookupError(objects, interface, name)
ComponentLookupError: ((<zope.schema._field.Object object at 0x4282b70>, <zope.publisher.browser.BrowserRequest instance URL=http://localhost:8080/@@+/action.html>), <InterfaceClass zope.app.form.interfaces.IInputWidget>, u'') - - [11/May/2006:11:56:47 -0500] "GET /@@+/action.html? type_name=AddPerson.html HTTP/1.1" 500 84 "http://localhost:8080/ @@contents.html" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en- US; rv: Gecko/20060427 Camino/1.0.1"


from zope.interface import Interface
import zope.schema

class IStreetAddress(Interface):
        """A vine street address"""
        street = zope.schema.Text (
                title=u"Street 1",
                description=u"The street address",
                required = False
        city = zope.schema.TextLine (
                description=u"The city.",
                required = False
        state = zope.schema.TextLine (
                description=u"The state.",
                required = False
        zipcode = zope.schema.TextLine (
                title=u"Zip Code",
                description=u"The zip code",
                required = False,
                min_length = 5

class IPerson(Interface):
        firstName = zope.schema.TextLine (
                title=u"First Name",
                description=u"The person's first name",
        lastName = zope.schema.TextLine (
                title=u"Last Name",
                description=u"The person's last name",
        address = zope.schema.Object (
                description=u"The person's adderess",
                schema = IStreetAddress


from persistent import Persistent
from zope.interface import implements

from abook.interfaces import IPerson
from abook.streetAddress import StreetAddress

class Person(Persistent):
        firstName = u""
        lastName = u""
        address = StreetAddress()


        <!-- Person -->
                interface       = ".interfaces.IPerson"
                type            = "zope.app.content.interfaces.IContentType"
        <content class = ".person.Person">
                        id                      = "simple_abook.person.Person"
                        description     = "A Person"
                        permission      = "zope.View"
                        interface       = ".interfaces.IPerson"
                        permission      = "zope.View"
                        set_schema      = ".interfaces.IPerson"
                label                   = "Add a Person"
                fields                  = "firstName lastName address"
                name                    = "AddPerson.html"
                schema                  = ".interfaces.IPerson"
                content_factory = ".person.Person"
                permission              = "zope.View"
                label                   = "Edit a Person"
                schema                  = ".interfaces.IPerson"
                for                             = ".interfaces.IPerson"
                fields                  = "firstName lastName address"
                name                    = "edit.html"
                permission              = "zope.View"
                menu                    = "zmi_views"
                title                   = "Edit"
                title                   = "A Person"
                description             = "Add a Person"
                view                    = "AddPerson.html"
                class                   = ".person.Person"
                permission              = "zope.View"

Zope3-users mailing list

Reply via email to