[Zope3-Users] specifying a container precondition to contain itself

Tom Dossis td at yoma.com.au
Thu Feb 17 22:45:25 EST 2005


How could I achieve the following declaration without getting the error:
NameError: 'IGameFolder' is not defined?


class IGame(Interface):
     pass

class IGameFolder(IContainer):

     def __setitem__(name, object):
	"""Add a game or game sub folder """

     __setitem__.precondition = ItemTypePrecondition(IGame, IGameFolder)


My current work around looks pretty ugly..

class IGameFolder(IContainer):

     def __setitem__(name, object):
	"""Add a game or game sub folder """

     __setitem__.precondition = ItemTypePrecondition(IGame)

IGameFolder['__setitem__'].setTaggedValue('precondition',
     ItemTypePrecondition(IGame, IGameFolder)
     )




More information about the Zope3-users mailing list