"Leichtman, David J" wrote:

> And when you programmatically add a ZClass instance, it's like this:
> <dtml-with "manage_addProducts('Your_product')">
>   <dtml-call "ZClass_name.ZClass_name_add(_.None,_)">
> </dtml-with>
> This creates the instance in the directory of the method from which the
> call was made.
> The Question:
> How do you go about adding an instance to a specific folder? I can't,
> for the life of me, figure it out. I've tried many different things,
> and I've looked for flags in createObjectInFolder, but to no avail.

You can wrap the call in another dtml-with.

<dtml-with my_desired_folder>
 <dtml-with "manage_addProducts('Your_product')">
   <dtml-call "ZClass_name.ZClass_name_add(_.None,_)">

That is assuming that my_desired_folder is aquirable(?) You may
need multiple -with's. Also using dotted syntax may work so that
you can use a single -with, i.e. <dtml-with
outer_folder.my_desired_folder>. I haven't tried this and I'm
sure one of the gurus here will let us know if this would work.

The other situation I ran into was when creating multiple nested
folders was that I only had the id of my_desired_folder as a
string so I had to use <dtml-with "_.getitem(id)">.

-- Tim Cook, President --
Free Practice Management,Inc. | http://FreePM.com
Office: (901) 884-4126
Censorship: The reaction of the ignorant to freedom.

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to