[Zope3-Users] Container Constraints
Marcus J. Ertl
marcus.ertl at larp-welt.de
Sat Dec 31 09:25:20 EST 2005
Hi!
I want to have container, witch should contain links and others
containers of his own type! What I did is this in my interface-definition:
class ILinkContainer(IContainer):
"""Basic folder, containing only links and other link folders."""
def __setitem__(name, object):
""" Add an ITodo object. """
__setitem__.precondition = ItemTypePrecondition(ILink, ILinkContainer)
But zope tells me:
NameError: name 'ILinkContainer' is not defined
I'm shure, he is right! It's a little bit of recursion at this place.
But what to do?
Creating a marker interface? Something like:
class IMarker(IContainer):
""" ... """
class ILinkContainer(IMarker):
"""Basic folder, containing only links and other link folders."""
def __setitem__(name, object):
""" Add an ITodo object. """
__setitem__.precondition = ItemTypePrecondition(ILink, IMarker)
Should work, but why creating a Interface "for nothing"? Must be a
better way!
And last but not least: Happy new Year!
Bye
Marcus Ertl
More information about the Zope3-users
mailing list