[Zope] Adding ZClass from inside of a ZClass

James W. Howe jwh@allencreek.com
Fri, 21 Jan 2000 17:40:21 -0500


I have a ZClass which inherits from ObjectManager.  When I create an 
instance of this ZClass, I also want to automatically create an instance of 
another ZClass that I have created.  I've looked at the How To on doing 
this but things aren't working quite right.  When I add my new instance of 
my ZClass ObjectManager, my second ZClass gets added not to my new ZClass 
instance, but the folder which contains the new ZClass instance.  In other 
words, what I wanted to get was:

FolderA
      ZClass1
           ZClass2

but I'm getting:

FolderA
     ZClass1
     ZClass2

the Add method for ZClass1 looks like this:

<dtml-call "REQUEST.set('id', 'some id for ZClass1')">

<dtml-with "ZClass1.createInObjectManager(REQUEST['id'], REQUEST)">
     <dtml-call 
"propertysheets.instanceProperties.manage_editProperties(REQUEST)">

     <dtml-call "REQUEST.set('id', 'some id for ZClass2')">
     [... other stuff ...]
     <dtml-call "ZClass2_add(_.None, _, NoRedir=1)">
</dtml-with>
<dtml-if NoRedir>
<dtml-else>
<dtml-if DestinationURL>
    [... standard stuff ...]
</dtml-if>
</dtml-if>

What trick am I missing?

Thanks

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