[Zope3-Users] IAdding behaviour changed from 3.2 to 3.3

Lorenzo Gil Sanchez lgs at sicem.biz
Sat Oct 14 06:50:53 EDT 2006


Hi,

I'm having problems with my Add Forms views (based in
formlib.form.AddForm) in my transition from Zope 3.2 to Zope 3.3.

In Zope 3.2 I registered my views like this:

<page
      for="zope.app.container.interfaces.IAdding"
      name="addPerson.html"
      class=".person.AddForm"
      permission="zope.Public"
      menu="zmi_views"
      title="Add Person"
      />

And my container implemented the marker interface zope.app.container.interfaces.IContentContainer.
The default view for my container has an 'Add' button with an action that just redirect
to '+/addPerson.html'

Everything worked fine with this model.

Now, in Zope 3.3 I have two problems:

1. If I don't add the directive <containerViews> to my container I get a NotFound exception when 
   going to '/mycontainer/+/addPerson.html'. To fix this problem I have added this directive:

  <view
      name="+"
      for="myapp.interfaces.IMyContainer"
      class="zope.app.container.browser.adding.Adding"
      permission="zope.ManageContent"
      />

2. When my add form is displayed in the Rotterdam skin I get an extra tab for every other contenttype
I have a page registered like the example above. For example, I also have a Product content type and it
has an AddForm like the Person AddForm. When I'm looking at '/mycontainer/+/addPerson.html' I got 4 tabs:

  - Add (the one for adding the person)
  - Add Product
  - Introspection
  - Registration

And obviously I shouldn't get the second tab. Looks like it is showing everything that is registered for the
IAdding interface, and that sound logical but my question is: Why it didn't work that way in Zope 3.2? and,
How do I get my expected behavior?

Best regards,

Lorenzo Gil


Extra thoughts: Probably the cause of my problems is that I don't fully understand the adding process
in Zope 3 so I'll try to explain what I think it is happening just in case anyone can correct me if I'm wrong:

When traversing '/mycontainer/+/addPerson.html' Zope gets to the '+' path and it gets a view for the
IMyContainer interface. This view is handled by the zope.app.container.browser.adding.Adding class that
implements the zope.app.container.interfaces.IAdding interface. Then, traversal continues to 'addPerson.html'
and Zope gets my view that is registered for IAdding. So I got a view for a (previous) view object that is
applied to my container. That's why in my AddForm self.context is the Adding object and self.context.context
is my container object.



More information about the Zope3-users mailing list