[Zope] Adding a ZClass to a specific location

Kevin Dangoor kid@kendermedia.com
Wed, 5 Jan 2000 11:31:54 -0500


----- Original Message -----
From: "Jason Spisak" <webmaster@mtear.com>
To: <zope@zope.org>
Sent: Wednesday, January 05, 2000 9:20 AM
Subject: [Zope] Adding a ZClass to a specific location


> Maybe Kevin Dangoor has the answer to this after looking at his how-to
> on ZClass instances creation via DTML.  I'm trying to add a ZClas
> instance to a spcific folder that is at a different place in the
> hirearchy than the method that is calling the ZClass creation.  I'd like
> to create a ZClass instance of MyZClass inside FolderA, by calling a
> method from inside FolderB.  Any way to do this?

Here's my guess (untested)... this assumes you can get to FolderB directly
(via acquisition or because FolderB is in FolderA)

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

If your ZClass is CatalogAware, this won't work quite right, because the
path to the instance that is stored in the catalog will be something like:

/FolderA/FolderB/instance

instead of /FolderB/instance

Kevin