[Zope] Zope context

Oliver Bleutgen myzope@gmx.net
Mon, 05 Aug 2002 18:59:09 +0200


Bo M. Maryniuck wrote:
> On Monday 05 August 2002 18:19, Oliver Bleutgen wrote:
> [SKIPPED]
> 
>>What exactly is the "context" now?
> 
> 
> Well, you're right. But how to simple call "manage_addSomething" or 
> "manage_delObject['SomeObject']" from a Z Product *Class*?
> 

In practice, while instanciating your class, you want to simultanously 
add subobjects?

Something like this (stolen from zopelabs.com, see
http://www.zopelabs.com/cookbook/995468614


def __init__(self, acquiredObjectName, container):
     """Initialize my instance"""
     self = self.__of__(container) # Create an acquisition wrapper
     acquiredObject = getattr(self, acquiredObjectName) # Acquire the object


HTH,
oliver