[Zope] Creating ZClass instances at different locations

Simon Brogden sbrogden@ehive.co.uk
Tue, 22 Jan 2002 13:30:16 -0000


Hello,

I've got a ZClass, instances of which are created programmatically. That =
bit works fine, but ...

I can't get my head round how to specify where the instance is created. =
I'm using a Formulator form (great product BTW) to capture the stuff the =
class needs and perform the validation. Trouble is, the class instace is =
being created inside the Formulator form.

The DTML I'm using to create the instance is:

<dtml-with "form">=20
<dtml-try>
<dtml-call "validate_all_to_request(REQUEST)">
<dtml-except FormValidationError>
<dtml-var standard_html_header>
<ul>
<dtml-in "error_value.errors">
<li>
<dtml-var "field.get_value('title')">:
<dtml-var error_text>
</li>
</dtml-in>
</ul>
<dtml-else>
    <dtml-with "manage_addProduct['MyProduct']">
       <dtml-call "MyProduct_add(_.None, _, NoRedir=3D1)">
    </dtml-with>


</dtml-try>
</dtml-with>

What I want to do is have the instance created at a location specified =
by a property. If the form & DTML method used to create the instance =
lived in "/MyFolder/MyForms/Add" and I created a string property, say on =
"MyFolder" level, named "create_in" and set it to "/MyFolder/MyClasses", =
the class would be created in that folder.

I've had a butchers through the list archives and get the impression =
that I'm approaching this the wrong way. It seems that the location that =
the instance is created in is based on where the code creating it is =
stored.=20

Thanks for your time,
Simon.