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
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to