[Zope-dev] Object dereferancing Question
Jeff
jeff@hi-privacy.net
Tue, 8 May 2001 15:06:33 -0500
This is a multi-part message in MIME format.
------=_NextPart_000_01E7_01C0D7D0.78697340
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi ya'll,
I have created a product with a zclass that contains a zclass; classA =
contains classB.=20
Both use 'Folder' as bases class.
I want the classB objects to have a 'default rendering' capability so I =
added a DTML Method named index_html to classB with the following code:
<dtml-var expr=3D"_.getitem(template, 1)">
Where 'template' is a property of the object that has a method name in =
it.
So far so good, if I navigate to a classB object the correct method is =
called and the object is rendered.
Now for the part I don't understand.....
I have a page where I would like dynamically display a classB object. I =
used the following:
<dtml-var expr=3D"_.getitem(index_object, 1)">
Where 'index_object' is the id of a classB object within the name space =
(same folder).
I thought that this would call the 'default rendering' for the named =
object, but instead returns the object.
The following code worked:
<dtml-with expr=3D"_.getitem(index_object, 0)">
<dtml-var index_html>
</dtml-with>
Why does the "_.getitem(index_object, 1)" not return the rendered =
object?
Thanks,
Jeff
------=_NextPart_000_01E7_01C0D7D0.78697340
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi ya'll,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I have created a product with a zclass =
that=20
contains a zclass; classA contains classB. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Both use 'Folder' as bases =
class.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I want the classB objects to have a =
'default=20
rendering' capability so I added a DTML Method named index_html to =
classB with=20
the following code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><dtml-var =
expr=3D"_.getitem(template,=20
1)"></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Where 'template' is a property of the =
object that=20
has a method name in it.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>So far so good, if I navigate to a =
classB object=20
the correct method is called and the object is rendered.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Now for the part I don't=20
understand.....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I have a page where I would like =
dynamically=20
display a classB object. I used the following:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><dtml-var =
expr=3D"_.getitem(index_object,=20
1)"></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Where 'index_object' is the id of a =
classB object=20
within the name space (same folder).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I thought that this would call the =
'default=20
rendering' for the named object, but instead returns the =
object.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The following code worked:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><dtml-with =
expr=3D"_.getitem(index_object,=20
0)"><BR> <dtml-var =
index_html><BR></dtml-with><BR></DIV>
<DIV>Why does the "_.getitem(index_object, 1)" not return the rendered=20
object?<BR></DIV>
<DIV>Thanks,</DIV>
<DIV>Jeff</DIV></FONT></BODY></HTML>
------=_NextPart_000_01E7_01C0D7D0.78697340--