[Zope3-Users] stuck with zope.schema.Object

Adam Groszer adamg at fw.hu
Thu Apr 14 13:28:39 EDT 2005


I defined an interface like this:

class IBejegyzes(Interface):
<snip>
    sablon = Text(
        title=u"Sablon",
        required=True
        )

implemented it:

class Bejegyzes(BTreeContainer):
    implements(IBejegyzes, IBejegyzesContainer, IBejegyzesContained)
<snip>
    sablon = FieldProperty(IBejegyzes['sablon'])

configured it:

  <interface
      interface=".interfaces.IBejegyzes"
      type="zope.app.content.interfaces.IContentType"
      /> 

  <content class=".bejegyzes.Bejegyzes">
    <factory
        id="dkr.Bejegyzes"
        title="Uj bejegyzés készitése"
        description="This factory instantiates new Bejegyzes"
        />
        <implements
        interface="zope.app.annotation.interfaces.IAttributeAnnotatable
                zope.app.container.interfaces.IContentContainer"
        />
    <require
        permission="zope.View"
        interface=".interfaces.IBejegyzes"
        />
    <require
        permission="zope.ManageContent"
        interface=".interfaces.IBejegyzesContainer"
        />
    <require
        permission="zope.ManageContent"
        set_schema=".interfaces.IBejegyzes"
        />
  </content>

  <browser:addform
      label="Uj Bejegyzés"
      name="AddBejegyzes.html"
      schema="dkr.interfaces.IBejegyzes"
      content_factory="dkr.bejegyzes.Bejegyzes"
      permission="zope.ManageContent" 
          set_before_add="code"
      />

  <browser:addMenuItem
      title="Bejegyzés"
      class="dkr.bejegyzes.Bejegyzes"
      permission="zope.ManageContent"
      view="AddBejegyzes.html"
      />  

it works fine. As soon as I change the interface to: (and delete
data.fs and friends)

class IBejegyzes(Interface):
<snip>
    sablon = Object(
        schema=ISablon,
        title=u"Sablon",
        required=True
        )

as I want to add a new object to it's container, the following
exception comes:

  File "Y:\zope\svn_zope3\src\zope\component\__init__.py", line 154, in getMulti
Adapter
    raise ComponentLookupError(objects, interface, name)
ComponentLookupError: ((<zope.schema._field.Object object at 0x030F91F0>, <zope.
publisher.browser.BrowserRequest instance URL=http://localhost:8080/2/@@+/action
.html>), <InterfaceClass zope.app.form.interfaces.IInputWidget>, u'')
127.0.0.1 - zope.manager [14/Apr/2005:19:22:46 +0200] "GET /2/@@+/action.html?ty
pe_name=AddBejegyzes.html HTTP/1.1" 500 311 "http://localhost:8080/2/@@contents.
html" "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050317
Firefox/1.0.2"

Do I missed something? What is the problem?

-- 
Best regards,
 Adam                          mailto:adamg at fw.hu




More information about the Zope3-users mailing list