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

Park, Karl Karl.Park@korea.bowneglobal.com
Tue, 23 May 2000 14:50:56 +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_01BFC47A.DD266B40
Content-Type: text/plain;
	charset="iso-2022-kr"

Hello Karl, who has same name as me:-)

Yes, I can create child zclass nested in parent zclass according to the
Howto on management interface.
And the zclasses were inherited from Object Manager and Catalog aware class.

But still I can't do it programatically.
If you know how to do it, your advice would be appreciated.
(Due to the schedule, I decided to just go ahead according to Rik
Hoekstra's advice)

I found a interesting fact.
When we access some ZClass in the product folder, the typical syntax used
is(in DTML)
	this().Control_Panel.Products['MyProductFolderName'](DTML)
	self.Control_Panel.Products['MyProductFolderName'] (Python)

This syntax seems to say that Products is a dictionary object of Python,
because 
we can access each product folder by key.
But when I try this,
	<dtml-var "_.len(this().Control_Panel.Products">
this returns just "1"
But interestingly, 
	<dtml-in "this().Control_Panel.Products.objectIds()>
		- or - 
	<dtml-in
"this().Control_Panel.Products['MyProductFolderName'].objectIds()">
returns expected results.

Should I think "Product" folder under "Control_Panel" to be a kind of
dictionary object?
Thanks a lot
Karl

Message: 17
To: "Zope-Dev \(E-mail\)" <zope-dev@zope.org>
Subject: Re: [Zope-dev] Please HELP: Nested ZClass, Nested instance
From: Karl Anderson <karl@digicool.com>
Organization: Digital Creations
Date: 22 May 2000 15:34:57 -0700

"Park, Karl" <Karl.Park@korea.bowneglobal.com> writes:

> I created a ZClass in the Product folder. And anther ZClass under the
> ZClass(thus nested class)

> To do it, I created a DTML Method which accepts user's input and then, if
> needed, it have to create an object.

> 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....

I had some hassles with this recently.  There's a HOWTO at:

http://www.zope.org/Members/gtk/containers

Can you create the child zclass from the manage screen inside the
parent zclass?

Does the parent zclass inherit from ObjectManager before any other
superclasses?

-- 
Karl Anderson                          karl@digicool.com


------_=_NextPart_001_01BFC47A.DD266B40
Content-Type: text/html;
	charset="iso-2022-kr"
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-2022-kr">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>Re: [Zope-dev] Please HELP: Nested ZClass, Nested =
instance</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Hello Karl, who has same name as me:-)</FONT>
</P>

<P><FONT SIZE=3D2>Yes, I can create child zclass nested in parent =
zclass according to the Howto on management interface.</FONT>
<BR><FONT SIZE=3D2>And the zclasses were inherited from Object Manager =
and Catalog aware class.</FONT>
</P>

<P><FONT SIZE=3D2>But still I can't do it programatically.</FONT>
<BR><FONT SIZE=3D2>If you know how to do it, your advice would be =
appreciated.</FONT>
<BR><FONT SIZE=3D2>(Due to the schedule, I decided to just go ahead =
according to Rik Hoekstra's advice)</FONT>
</P>

<P><FONT SIZE=3D2>I found a interesting fact.</FONT>
<BR><FONT SIZE=3D2>When we access some ZClass in the product folder, =
the typical syntax used is(in DTML)</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>this().Control_Panel.Products['MyProductFolderName'](DTML)</FON=
T>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>self.Control_Panel.Products['MyProductFolderName'] =
(Python)</FONT>
</P>

<P><FONT SIZE=3D2>This syntax seems to say that Products is a =
dictionary object of Python, because </FONT>
<BR><FONT SIZE=3D2>we can access each product folder by key.</FONT>
<BR><FONT SIZE=3D2>But when I try this,</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;dtml-var =
&quot;_.len(this().Control_Panel.Products&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>this returns just &quot;1&quot;</FONT>
<BR><FONT SIZE=3D2>But interestingly, </FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;dtml-in =
&quot;this().Control_Panel.Products.objectIds()&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>- or - =
</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;dtml-in =
&quot;this().Control_Panel.Products['MyProductFolderName'].objectIds()&q=
uot;&gt;</FONT>
<BR><FONT SIZE=3D2>returns expected results.</FONT>
</P>

<P><FONT SIZE=3D2>Should I think &quot;Product&quot; folder under =
&quot;Control_Panel&quot; to be a kind of dictionary object?</FONT>
<BR><FONT SIZE=3D2>Thanks a lot</FONT>
<BR><FONT SIZE=3D2>Karl</FONT>
</P>

<P><FONT SIZE=3D2>Message: 17</FONT>
<BR><FONT SIZE=3D2>To: &quot;Zope-Dev \(E-mail\)&quot; =
&lt;zope-dev@zope.org&gt;</FONT>
<BR><FONT SIZE=3D2>Subject: Re: [Zope-dev] Please HELP: Nested ZClass, =
Nested instance</FONT>
<BR><FONT SIZE=3D2>From: Karl Anderson &lt;karl@digicool.com&gt;</FONT>
<BR><FONT SIZE=3D2>Organization: Digital Creations</FONT>
<BR><FONT SIZE=3D2>Date: 22 May 2000 15:34:57 -0700</FONT>
</P>

<P><FONT SIZE=3D2>&quot;Park, Karl&quot; =
&lt;Karl.Park@korea.bowneglobal.com&gt; writes:</FONT>
</P>

<P><FONT SIZE=3D2>&gt; I created a ZClass in the Product folder. And =
anther ZClass under the</FONT>
<BR><FONT SIZE=3D2>&gt; ZClass(thus nested class)</FONT>
</P>

<P><FONT SIZE=3D2>&gt; To do it, I created a DTML Method which accepts =
user's input and then, if</FONT>
<BR><FONT SIZE=3D2>&gt; needed, it have to create an object.</FONT>
</P>

<P><FONT SIZE=3D2>&gt; First part is to create the parent object, which =
works just fine. </FONT>
<BR><FONT SIZE=3D2>&gt; But the sencond part to create the child object =
doesn't seem to work. </FONT>
<BR><FONT SIZE=3D2>&gt; If I take the easy way, that is, creating =
othere ZClass on the top of the</FONT>
<BR><FONT SIZE=3D2>&gt; products folder of Control Panel, I can do it. =
</FONT>
<BR><FONT SIZE=3D2>&gt; But I don't think it is a good desing from the =
perspective of OOP....</FONT>
</P>

<P><FONT SIZE=3D2>I had some hassles with this recently.&nbsp; There's =
a HOWTO at:</FONT>
</P>

<P><FONT SIZE=3D2><A =
HREF=3D"http://www.zope.org/Members/gtk/containers" =
TARGET=3D"_blank">http://www.zope.org/Members/gtk/containers</A></FONT>
</P>

<P><FONT SIZE=3D2>Can you create the child zclass from the manage =
screen inside the</FONT>
<BR><FONT SIZE=3D2>parent zclass?</FONT>
</P>

<P><FONT SIZE=3D2>Does the parent zclass inherit from ObjectManager =
before any other</FONT>
<BR><FONT SIZE=3D2>superclasses?</FONT>
</P>

<P><FONT SIZE=3D2>-- </FONT>
<BR><FONT SIZE=3D2>Karl =
Anderson&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; karl@digicool.com</FONT>
</P>

</BODY>

------_=_NextPart_001_01BFC47A.DD266B40--