Object dereferancing Question
Hi ya'll, I have created a product with a zclass that contains a zclass; classA contains classB. 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="_.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="_.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="_.getitem(index_object, 0)"> <dtml-var index_html> </dtml-with> Why does the "_.getitem(index_object, 1)" not return the rendered object? Thanks, Jeff
On Tue, 8 May 2001, Jeff wrote:
I have created a product with a zclass that contains a zclass; classA contains classB. [...] 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="_.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.
'1' means "call the object if it is callable". ZClasses are not callable. Therefore you get the object back. See the Renderable Product if you want to fix this <grin>. --RDM
"R. David Murray" wrote:
On Tue, 8 May 2001, Jeff wrote:
I have created a product with a zclass that contains a zclass; classA contains classB. [...] 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="_.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.
'1' means "call the object if it is callable". ZClasses are not callable. Therefore you get the object back.
See the Renderable Product if you want to fix this <grin>.
--RDM
This strikes me as a bug. How would you all react to making ZClass instances callable and have their behavior be: look for an instance method index_html and call it, and failing that, just return the object. Thoughts? -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
participants (3)
-
Casey Duncan -
Jeff -
R. David Murray