[Zope3-Users] Recursive zope.app.container.constraints.contains()

Dragos Petre drpetrea at gmail.com
Thu Nov 6 08:27:27 EST 2008


Hi everybody!

total newbie question regarding the behaviour of
zope.app.container.constraints functionality: as it is now, the
containing constraints of an interface (defined by the arguments of
the contains(*types) function) are not inherited from the interface's
parents.

As an example, suppose I have the below in the colligo/test1.py module:

from zope.interface import Interface, implements
from zope.app.container.constraints import contains, containers, checkObject
from zope.app.container.btree import BTreeContainer

class I1(Interface):
    contains('colligo.test1.I2')

class I11(I1):
    contains('colligo.test1.I3')

class I2(Interface):
    containers('colligo.test1.I1')

class I3(Interface):
    containers('colligo.test1'colligo.nomisma.interfaces.INomismaBaseDenomination'.I11')

class A1(BTreeContainer):
    implements(I1)

class A11(BTreeContainer):
    implements(I11)

class A2(object):
    implements(I2)

class A3(object):
    implements(I3)


In this case, an instance of A11 will only accept A3 objects as
children but not A2 ones as one would expect given the definition of
the parent.

Would it be interesting to have such behaviour implemented?

Thanks,
Dragos.


More information about the Zope3-users mailing list