[Zope3-Users] question about a constraint conflict

FB fbo2 at gmx.net
Mon Jan 8 03:12:27 EST 2007


Hi,

On Sun, Jan 07, 2007 at 02:10:20PM +0100, Christophe Combelles wrote:

[snip]

> I understand there is an inconsistency between these two interfaces, and this 
> is not a correct solution.
> But using just containers() on content objects doesn't prevent their containers
> >from displaying everything in the Add Menu.
> It just prevents from adding these objects in other containers.

You could use a another interface (i.e. IForOrBar) and something like

 class IFoo(IFooOrBar):
    pass
 
 class IBar(IFooOrBar):
    pass
 
 class IFooContainer(Interface):
    contains(IFooOrBar)
 
 class IBarContainer(Interface):
    contains(IFooOrBar)
 
 class IFooBarContainer(IFooContainer,IBarContainer):
    pass
 
 This way, Foo and Bar have to depend on another package (The one containing
 IFooOrBar). Neither does this package need to know anything about IFoo or IBar,
 nor does IFoo have to know anything about IBar or vice versa.
 
 Regards,
 
 Frank
 
 


More information about the Zope3-users mailing list