On Sat, Jan 06, 2007 at 01:35:35AM +0100, Christophe Combelles wrote:
> I define the following interfaces:
> class IFoo(Interface):
> class IBar(Interface):
> class IFooContainer(IContainer):
> class IBarContainer(IContainer):
> Then I would like to configure a class Test to to be both a FooContainer and
> a BarContainer:
> <zope:class class=".test.Test">
> <implements interface=".interfaces.IFooContainer" />
> <implements interface=".interfaces.IBarContainer" />
> Then I define AddMenuEntries for Foo and Bar implementations.
> This does not work and as a result I only get Foo in the Add Menu. If I
> switch the two
> implements zcml directives, I obviously get only Bar.
> Is there a solution to configure a class to be both a FooContainer and a
> BarContainer with
> constraintment ? (I would like to avoid dependencies between Foo, Bar and
IHMO you should use the containers()-statement on IFoo and IBar instead of
contains() on their containers. Even if the contains-constraints of
IFooContainer and IBarContainer would be merged somehow on the Test-class,
it wouldn't behave as you expect:
The contains()-statement can be read as "mustn't contain anything but...".
Mixing those two constraints depending on two different contained interfaces
would result in "Can't contain anything.".
This makes sense, if you have classes, relying on self.values() returning
but objects implementing the given interface.
Zope3-users mailing list