In the following example, I want objects implementing IParentInterface to be required to supply a mycollection attribute that is a list of objects implementing IChildInterface.
from zope.schema import Text, List
from zope.interface import Interface
class IChildInterface(Interface):
someField = Text()
class IParentInterface(Interface):
mycollection = List(value_type=IChildInterface)
Is there a straightforward way to do this, or would I need to use invariants?
This should work: