[Zope-dev] Please HELP: Nested ZClass, Nested instance

Park, Karl Karl.Park@korea.bowneglobal.com
Mon, 22 May 2000 15:31:53 +0900


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_01BFC3B7.6B68CCC8
Content-Type: text/plain;
	charset="iso-8859-1"

Hello All
My name is Karl Park.
I am preety new, but very serious in developing on Zope, because my
company's intranet is going to move to Zope.
There's one problem that I have been struggling with, but still I couldn't
find solutions for it.
I looked through the how-to's and archives, but could find what I really
want to see..

So, if there's anybody that can help me with this, could you please give me
your solution as to this?


Let me describe my situation below.
I created a ZClass in the Product folder. And anther ZClass under the
ZClass(thus nested class)
Thus it loos like something like this.
/
   Control_Panel
        Products          ------------------------------------------>Product
Folder
                ProjectSpec  --------------------------------------> My
Parent ZClass
                       ProductInfo  --------------------------------->
Nested ZClass of "ProjectSpec" ZClass
                       TranslationMemory   ---------------------> Nested
ZClass of "ProjectSpec" ZClass
   ProjectHome   --------------------------------------------------> Home
folder from which to down, my application resides
        ProjectSpecEntry ---------------------------------------->  All the
instances of ProjectSpec will reside here for retrival, viewing, editing
etc...

We have many projects, and instance(object) of ProjectSpec Object should be
programatically 
created of edited through the web interface.

My battle was, create a child object(instance of "ProductInfo" or
"TranslationMemory") inside an
object which is instance of "ProjectSpec" object. The reason why I designed
my classes like this was,
as all of you know well, I didn't want fo fill up the "Add List" with lots
of ZClass list. 
From the theoretical perspective,  ProductInfo class(object),
TranslationMemory class(object) cannot be thought of without having the
ProjectSpec object.

To do it, I created a DTML Method which accepts user's input and then, if
needed, it have to create an object.
(User submits his/her project number in 'prjid' to this DTML method)
The code that I tried it is

<dtml-with "ProjectSpecEntry.manage_addProduct['LBUProjectSpec']">

       <dtml-with "ProjectSpec.createInObjectManager(REQUEST['prjid'],
REQUEST)">
          <dtml-call
"propertysheets.General.manage_editProperties(REQUEST)">
          <dtml-call reindex_object>
       </dtml-with>


       <dtml-with "_[REQUEST['prjid']]">
           <dtml-with "manage_addProduct['LBUProductInfo']">
               <dtml-with "ProductInfo.createInObjectManager('Product Info',
REQUEST)">
 
..........................................................................
               </dtml-with>
           </dtml-with>
       </dtml-with>
    </dtml-with>
</dtml-with>

First part is to create the parent object, which works just fine. 
But the sencond part to create the child object doesn't seem to work. 
If I take the easy way, that is, creating othere ZClass on the top of the
products folder of Control Panel, I can do it. 
But I don't think it is a good desing from the perspective of OOP....

Could any one of you have solution to this, so that I can keep the Class
Hierarchy as above and create the object nested?
Your kind reply would be greatly appreciated.
Best Regards
Karl



------_=_NextPart_001_01BFC3B7.6B68CCC8
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>Please HELP: Nested ZClass, Nested instance</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2 FACE=3D"Arial">Hello All</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">My name is Karl Park.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">I am preety new, but very serious in =
developing on Zope, because my company's intranet is going to move to =
Zope.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">There's one problem that I have been =
struggling with, but still I couldn't find solutions for it.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">I looked through the how-to's and =
archives, but could find what I really want to see..</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">So, if there's anybody that can help =
me with this, could you please give me your solution as to this?</FONT>
</P>
<BR>

<P><FONT SIZE=3D2 FACE=3D"Arial">Let me describe my situation =
below.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">I created a ZClass in the Product =
folder. And anther ZClass under the ZClass(thus nested class)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Thus it loos like something like =
this.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">/</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp; Control_Panel</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
Products&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
------------------------------------------&gt;Product Folder</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ProjectSpec&nbsp; =
--------------------------------------&gt; My Parent ZClass</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; ProductInfo&nbsp; ---------------------------------&gt; Nested =
ZClass of &quot;ProjectSpec&quot; ZClass</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; TranslationMemory&nbsp;&nbsp; ---------------------&gt; Nested =
ZClass of &quot;ProjectSpec&quot; ZClass</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp; ProjectHome&nbsp;&nbsp; =
--------------------------------------------------&gt; Home folder from =
which to down, my application resides</FONT></P>

<P><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
ProjectSpecEntry ----------------------------------------&gt;&nbsp; All =
the instances of ProjectSpec will reside here for retrival, viewing, =
editing etc...</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">We have many projects, and =
instance(object) of ProjectSpec Object should be programatically =
</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">created of edited through the web =
interface.</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">My battle was, create a child =
object(instance of &quot;ProductInfo&quot; or =
&quot;TranslationMemory&quot;) inside an</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">object which is instance of =
&quot;ProjectSpec&quot; object. The reason why I designed my classes =
like this was,</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">as all of you know well, I didn't =
want fo fill up the &quot;Add List&quot; with lots of ZClass list. =
</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">From the theoretical =
perspective,&nbsp; ProductInfo class(object), TranslationMemory =
class(object) cannot be thought of without having the</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">ProjectSpec object.</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">To do it, I created a DTML Method =
which accepts user's input and then, if needed, it have to create an =
object.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">(User submits his/her project number =
in 'prjid' to this DTML method)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">The code that I tried it is</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">&lt;dtml-with =
&quot;ProjectSpecEntry.manage_addProduct['LBUProjectSpec']&quot;&gt;</FO=
NT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;dtml-with &quot;ProjectSpec.createInObjectManager(REQUEST['prjid'], =
REQUEST)&quot;&gt;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;dtml-call =
&quot;propertysheets.General.manage_editProperties(REQUEST)&quot;&gt;</F=
ONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;dtml-call reindex_object&gt;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;/dtml-with&gt;</FONT>
</P>
<BR>

<P><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;dtml-with &quot;_[REQUEST['prjid']]&quot;&gt;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; &lt;dtml-with =
&quot;manage_addProduct['LBUProductInfo']&quot;&gt;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;dtml-with =
&quot;ProductInfo.createInObjectManager('Product Info', =
REQUEST)&quot;&gt;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
.......................................................................=
...</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/dtml-with&gt;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; &lt;/dtml-with&gt;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;/dtml-with&gt;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp; =
&lt;/dtml-with&gt;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&lt;/dtml-with&gt;</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">First part is to create the parent =
object, which works just fine. </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">But the sencond part to create the =
child object doesn't seem to work. </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">If I take the easy way, that is, =
creating othere ZClass on the top of the products folder of Control =
Panel, I can do it. </FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">But I don't think it is a good desing =
from the perspective of OOP....</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Could any one of you have solution to =
this, so that I can keep the Class Hierarchy as above and create the =
object nested?</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Your kind reply would be greatly =
appreciated.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Best Regards</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Karl</FONT>
</P>
<BR>

</BODY>
</HTML>
------_=_NextPart_001_01BFC3B7.6B68CCC8--