[Zope] Adding ZClasses within ZClasses (more questions)

James W. Howe jwh@allencreek.com
Mon, 24 Jan 2000 11:25:50 -0500


I've managed to successfully create an instance of a ZClass within another 
ZClass programatically.  However, I'm not sure why what I did worked.  I 
have a ZClass which has ObjectManager behavior.  When I create an instance 
of this ZClass, I also want to create a DTMLMethod and another ZClass as 
contents of my outer ZClass.  To create the DTMLMethod, I'm able to do the 
following in my ZClass1_add method:

<dtml-call "manage_addDTMLMethod(...)">

This creates a new DTMLMethod as an item contained by my ZClass1 
instance.  If I try to add my ZClass2 using a similar method:

<dtml-call "ZClass2_add(...)">

it ends up being put at the same level as my ZClass1 instance.  However, if 
I do the following:

<dtml-with "manage_addProduct['my product']">
    <dtml-call "ZClass2_add(...)">
</dtml-with>

my ZClass2 is added as an item contained by ZClass1.  This raises a couple 
of questions.  First, why does the manage_addDTMLMethod(...) work without 
any extra effort?  What is it about manage_addDTMLMethod which knows that 
the new method should be contained within my ZClass1 instance?  Second, why 
does manage_addProduct['...'] work?  My product already existed and I'm not 
really adding a new product, so why do I need to call manage_addProduct?

Thanks.

James W. Howe				mailto:jwh@allencreek.com
Allen Creek Software, Inc.		pgpkey: http://ic.net/~jwh/pgpkey.html		
Ann Arbor, MI  48103