[Zope3-dev] IAdding

Shane Hathaway shane at hathawaymix.org
Fri Nov 12 11:37:29 EST 2004


On Fri, November 12, 2004 6:59 am, Jim Fulton said:
> That's not quite right.  For better or worse, IAdding views are generally
> registered on a case-by-case basis.  This is normally done using the
> containerViews ZCML directive that is, essentially, a macro that
> configures
> contents, adding, and/or index views.

Ok.  I have a containerViews directive with no "add" or "index" attribute:

  <browser:containerViews
      for="scanstone.interfaces.IProcessControl"
      contents="zope.View"
      />

I guess this means it creates a contents view but not an adding view.

>> - Should those undocumented methods be declared in the IAdding
>> interface?
>> I'm happy to add them if that's the right thing to do.
>
> Absolutely. This was a sorry oversight. Thanks.

I was about to do it, but then I realized there's still a design issue. 
There is a BasicAdding class that implements IAdding, and an Adding class
that derives from BasicAdding.  If I add the methods that contents.pt
requires to IAdding, BasicAdding will no longer fulfill the contract
declared by IAdding.  Some code in contents.py uses BasicAdding directly. 
My guess is that BasicAdding and Adding should be combined into a single
class.  What do you think?

> Then why do need an adding.  If contents *requires* an adding, then that's
> a bug in contents that we ought to fix.

Ok, that makes sense.  What is the best way for a page template to detect
whether an adding exists?  "context/@@+|nothing" comes to mind, but maybe
there's a better way that doesn't swallow exceptions like "|nothing".

Shane




More information about the Zope3-dev mailing list