[Zope3-dev] IFolder and IAdding

Tim Terlegård tim at se.linux.org
Sat Oct 21 12:03:52 EDT 2006


There's a really useful method "add" in IAdding. As the novice zope3
developer I am I would like that method in IFolder (as well). Is there a
good reason why IFolder or IWriteContainer doesn't have an add method?
It's possible to add content to an IFolder through the IWriteContainer API,
but I'd rather use an add method that chooses an appropriate ID for the
object.

IAdding has some methods that seem to be about menus. Is this because
IAdding should be used together with browser:addMenuItem that also does
some menu stuff? Is IAdding only supposed to be used when dealing with
/@@+/somevieworfactory? I'd like to add stuff to the folder without
using @@+ in the url.

I want to use a formlib add form and I have a view called addEvent:

  <browser:page
      for="zope.app.folder.interfaces.IFolder"
      name="addEvent"
      class=".eventforms.EventAddForm"
      permission="zope.ManageContent"
      />

Submitting the form fails though. formlib (AddFormBase) assumes that the
context/folder provides IAdding and has an add method. So I can't use
for="IFolder". And I can only use IAdding when having /@@+/ in the url.
I guess I can make an adapter from IFolder to IAdding, but then I have
to implement those menu methods that neither me or the folder care
about.

So what's the deal with IFolder and IAdding? Why doesn't IFolder have an
add method? When should IAdding be used? Can formlib only be used with
folders that are adapted to IAdding? Why does IAdding contain menu
stuff? How do I use formlib without @@+?

Tim


More information about the Zope3-dev mailing list