[Zope] Adding ZClass Instances Programatically -- the theory?

Matt Jacobus mjacobus@iname.com
Sun, 7 Nov 1999 22:01:04 -0000


In the How-To written by tazzzzz it is explained that in order to add an
instance of a zclass you need to make the following call:

<dtml-call "YourZClass_add(_.None, _, NoRedir=1)">

As per the DTML doc, generally a folder or DTMLDocument is passed in as the
first argument and the REQUEST is passed as the second.  Would someone be
kind enough to describe the theory behind passing in None as the client and
"_" as the REQUEST mapping.

In my code I end up using the following so that the new instance will be
created in a subfolder:

    <dtml-with subfolder>
    <dtml-with "manage_addProduct['YourProduct']">
       <dtml-call "YourZClass_add(_.None, _, NoRedir=1)">
    </dtml-with>
    </dtml-with>

But once again I'm not entirely sure *why* it is that pushing the
subfolder's namespace on top of the stack and then passing the stack into
the REQUEST argument for YourZClass_add results in the instance being added
into subfolder.

Intuition would tell me to simply pass in the subfolder and the REQUEST
object as opposed to manipulating the stack directly and passing None and _.

What I think I'm really trying to understand is how the
createInObjectManager method resulting from:
	<dtml-with "YourZClass.createInObjectManager(REQUEST['id'], REQUEST)">
ends up with self populated with the correct folder.

Many thanks for any insight.

Matt