[Zope3-Users] Problem with containers

Rob Campbell rcampbell at pcwi.net
Thu Sep 14 19:38:15 EDT 2006


Hello,

I just recently started trying out Zope 3.  My first test project is a
few containers that can contain other containers or an object.  They are
laid out as follows:

FosterRecord
-> FosterSource
     -> Foster
     -> FosterGroup
        -> Foster

A FosterRecord is the top level container and can contain a
FosterSource.  A FosterSource can contain a Foster object or a
FosterGroup.  And a FosterGroup can contain a Foster object.

I setup this relationship with IContainer and IContained interfaces and
calls to contains() and containers().

I start adding containers and objects to create this structure through
the ZMI.  When I am ready to add a FosterGroup or a Foster to a
FosterSource, I do not get any options for them in the add menu.  I
haven't been able to find what is causing it.  I would guess it has
something to do with the constraints.

I am running this on Zope 3.3.0b2.  I am attaching my interfaces.py,
foster.py and configure.zcml.  Does anyone know what is causing this
problem?  Also, since I am new to Zope, does anyone have any suggestions
on a better or cleaner way of implementing this?  Thank you.

-- 
Rob Campbell

-------------- next part --------------
A non-text attachment was scrubbed...
Name: interfaces.py
Type: text/x-python
Size: 3997 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20060914/e0e0cd20/interfaces-0001.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foster.py
Type: text/x-python
Size: 2109 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20060914/e0e0cd20/foster-0001.py
-------------- next part --------------
<configure
  xmlns='http://namespaces.zope.org/zope'
  xmlns:browser='http://namespaces.zope.org/browser'
  i18n_domain='fosters'
  >

  <class class='.foster.FosterRecord'>
    <require
      permission='zope.View'
      interface='.interfaces.IFosterRecord'
    />
    <require
      permission='zope.ManageContent'
      set_schema='.interfaces.IFosterRecord'
    />
    <require
      permission='zope.View'
      interface='zope.app.container.interfaces.IReadContainer'
    />
    <require
      permission='zope.ManageContent'
      interface='zope.app.container.interfaces.IWriteContainer'
    />
  </class>

  <browser:containerViews
    for='.interfaces.IFosterRecord'
    add='zope.ManageContent'
    contents='zope.View'
    index='zope.View'
  />

  <browser:addMenuItem
    class='.foster.FosterRecord'
    title='Foster Records'
    view='addFosterRecord.html'
    permission='zope.ManageContent'
  />

  <browser:page
    for='zope.app.container.interfaces.IAdding'
    name='addFosterRecord.html'
    class='.browser.FosterRecordAddView'
    permission='zope.ManageContent'
  />
<!--
  <browser:page
    for='.interfaces.IFosterRecord'
    name='edit.html'
    class='.browser.FosterRecordEditView'
    permission='zope.ManageContent'
  />

  <browser:page
    for='.interfaces.IFosterRecord'
    name='index.html'
    class='.browser.FosterRecordDisplayView'
    permission='zope.View'
  />
-->
  <browser:page
    for='.interfaces.IFosterRecord'
    name='SelectedManagementView.html'
    class='.browser.FosterRecordEditView'
    permission='zope.ManageContent'
  />

  <class class='.foster.FosterSource'>
    <require
      permission='zope.View'
      interface='.interfaces.IFosterSource'
    />
    <require
      permission='zope.ManageContent'
      set_schema='.interfaces.IFosterSource'
    />
    <require
      permission='zope.View'
      interface='zope.app.container.interfaces.IReadContainer'
    />
    <require
      permission='zope.ManageContent'
      interface='zope.app.container.interfaces.IWriteContainer'
    />
  </class>

  <browser:containerViews
    for='.interfaces.IFosterSource'
    add='zope.ManageContent'
    contents='zope.View'
    index='zope.View'
  />

  <browser:addMenuItem
    class='.foster.FosterSource'
    title='Foster Source'
    view='addFosterSource.html'
    permission='zope.ManageContent'
  />

  <browser:page
    for='zope.app.container.interfaces.IAdding'
    name='addFosterSource.html'
    class='.browser.FosterSourceAddView'
    permission='zope.ManageContent'
  />
<!--
  <browser:page
    for='.interfaces.IFosterSource'
    name='edit.html'
    class='.browser.FosterSourceEditView'
    permission='zope.ManageContent'
  />

  <browser:page
    for='.interfaces.IFosterSource'
    name='index.html'
    class='.browser.FosterSourceDisplayView'
    permission='zope.View'
  />
-->
  <browser:page
    for='.interfaces.IFosterSource'
    name='SelectedManagementView.html'
    class='.browser.FosterSourceEditView'
    permission='zope.ManageContent'
  />

  <class class='.foster.FosterGroup'>
    <require
      permission='zope.View'
      interface='.interfaces.IFosterGroup'
    />
    <require
      permission='zope.ManageContent'
      set_schema='.interfaces.IFosterGroup'
    />
    <require
      permission='zope.View'
      interface='zope.app.container.interfaces.IReadContainer'
    />
    <require
      permission='zope.ManageContent'
      interface='zope.app.container.interfaces.IWriteContainer'
    />
  </class>

  <browser:containerViews
    for='.interfaces.IFosterGroup'
    add='zope.ManageContent'
    contents='zope.View'
    index='zope.View'
  />

  <browser:addMenuItem
    class='.foster.FosterGroup'
    title='Foster Group'
    view='addFosterGroup.html'
    permission='zope.ManageContent'
  />

  <browser:page
    for='zope.app.container.interfaces.IAdding'
    name='addFosterGroup.html'
    class='.browser.FosterGroupAddView'
    permission='zope.ManageContent'
  />
<!--
  <browser:page
    for='.interfaces.IFosterGroup'
    name='edit.html'
    class='.browser.FosterGroupEditView'
    permission='zope.ManageContent'
  />

  <browser:page
    for='.interfaces.IFosterGroup'
    name='index.html'
    class='.browser.FosterGroupDisplayView'
    permission='zope.View'
  />
-->
  <browser:page
    for='.interfaces.IFosterGroup'
    name='SelectedManagementView.html'
    class='.browser.FosterGroupEditView'
    permission='zope.ManageContent'
  />

  <class class='.foster.Foster'>
    <require
      permission='zope.View'
      interface='.interfaces.IFoster'
    />
    <require
      permission='zope.ManageContent'
      set_schema='.interfaces.IFoster'
    />
  </class>

  <browser:addMenuItem
    class='.foster.Foster'
    title='Foster'
    view='addFoster.html'
    permission='zope.ManageContent'
  />

  <browser:page
    for='zope.app.container.interfaces.IAdding'
    name='addFoster.html'
    class='.browser.FosterAddView'
    permission='zope.ManageContent'
  />

  <browser:page
    for='.interfaces.IFoster'
    name='edit.html'
    class='.browser.FosterEditView'
    permission='zope.ManageContent'
  />

  <browser:page
    for='.interfaces.IFoster'
    name='index.html'
    class='.browser.FosterDisplayView'
    permission='zope.View'
  />

  <browser:page
    for='.interfaces.IFoster'
    name='SelectedManagementView.html'
    class='.browser.FosterEditView'
    permission='zope.ManageContent'
  />

</configure>



More information about the Zope3-users mailing list