[Zope] adding zclass instance dynamically

Menard.Jean-Francois@hydro.qc.ca Menard.Jean-Francois@hydro.qc.ca
Mon, 19 Feb 2001 14:31:53 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C09AAA.9E171140
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Oliver,
	I posted the same question 3 days ago, with no response.  If you
find a way, I would be very interested to know it!

Good luck!

-----Message d'origine-----
De : Oliver Frommel [mailto:oliver@aec.at]
Envoy=E9 : lundi 19 f=E9vrier 2001 11:49
=C0 : zope@zope.org
Objet : [Zope] adding zclass instance dynamically


Hello,

how can I add a ZClass depending on a form value? I have a form =
variable=20
called "type" which contains the type of ZClass I want to add:

the "static" way is (working):
<dtml-with "manage_addProduct['MyObjects']">
  <dtml-with "article1.createInObjectManager(id, REQUEST)">
   <dtml-call "propertysheets.Basic.manage_editProperties(REQUEST)">
  </dtml-with>
</dtml-with>

now the form variable "type" either contains the string "article1" or=20
"article2".

but calling=20
<dtml-with "_[type].createInObjectManager(id, REQUEST)">
doesn't work.

what's the right way to do this?

thanks
--Oliver



_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -=20
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

------_=_NextPart_001_01C09AAA.9E171140
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>RE: [Zope] adding zclass instance dynamically</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Hi Oliver,</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>I posted =
the same question 3 days ago, with no response.&nbsp; If you find a =
way, I would be very interested to know it!</FONT></P>

<P><FONT SIZE=3D2>Good luck!</FONT>
</P>

<P><FONT SIZE=3D2>-----Message d'origine-----</FONT>
<BR><FONT SIZE=3D2>De : Oliver Frommel [<A =
HREF=3D"mailto:oliver@aec.at">mailto:oliver@aec.at</A>]</FONT>
<BR><FONT SIZE=3D2>Envoy=E9 : lundi 19 f=E9vrier 2001 11:49</FONT>
<BR><FONT SIZE=3D2>=C0 : zope@zope.org</FONT>
<BR><FONT SIZE=3D2>Objet : [Zope] adding zclass instance =
dynamically</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Hello,</FONT>
</P>

<P><FONT SIZE=3D2>how can I add a ZClass depending on a form value? I =
have a form variable </FONT>
<BR><FONT SIZE=3D2>called &quot;type&quot; which contains the type of =
ZClass I want to add:</FONT>
</P>

<P><FONT SIZE=3D2>the &quot;static&quot; way is (working):</FONT>
<BR><FONT SIZE=3D2>&lt;dtml-with =
&quot;manage_addProduct['MyObjects']&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp; &lt;dtml-with =
&quot;article1.createInObjectManager(id, REQUEST)&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; &lt;dtml-call =
&quot;propertysheets.Basic.manage_editProperties(REQUEST)&quot;&gt;</FON=
T>
<BR><FONT SIZE=3D2>&nbsp; &lt;/dtml-with&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/dtml-with&gt;</FONT>
</P>

<P><FONT SIZE=3D2>now the form variable &quot;type&quot; either =
contains the string &quot;article1&quot; or </FONT>
<BR><FONT SIZE=3D2>&quot;article2&quot;.</FONT>
</P>

<P><FONT SIZE=3D2>but calling </FONT>
<BR><FONT SIZE=3D2>&lt;dtml-with =
&quot;_[type].createInObjectManager(id, REQUEST)&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>doesn't work.</FONT>
</P>

<P><FONT SIZE=3D2>what's the right way to do this?</FONT>
</P>

<P><FONT SIZE=3D2>thanks</FONT>
<BR><FONT SIZE=3D2>--Oliver</FONT>
</P>
<BR>
<BR>

<P><FONT =
SIZE=3D2>_______________________________________________</FONT>
<BR><FONT SIZE=3D2>Zope maillist&nbsp; -&nbsp; Zope@zope.org</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://lists.zope.org/mailman/listinfo/zope" =
TARGET=3D"_blank">http://lists.zope.org/mailman/listinfo/zope</A></FONT>=

<BR><FONT SIZE=3D2>**&nbsp;&nbsp; No cross posts or HTML =
encoding!&nbsp; **</FONT>
<BR><FONT SIZE=3D2>(Related lists - </FONT>
<BR><FONT SIZE=3D2>&nbsp;<A =
HREF=3D"http://lists.zope.org/mailman/listinfo/zope-announce" =
TARGET=3D"_blank">http://lists.zope.org/mailman/listinfo/zope-announce</=
A></FONT>
<BR><FONT SIZE=3D2>&nbsp;<A =
HREF=3D"http://lists.zope.org/mailman/listinfo/zope-dev" =
TARGET=3D"_blank">http://lists.zope.org/mailman/listinfo/zope-dev</A> =
)</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C09AAA.9E171140--