[Zope] Re: Methods in a Simple Class

Alexandre Ratti alex@gabuzomeu.net
Tue, 14 Mar 2000 13:09:10 +0100


Salut Olivier,


Did you solve your issue below? If not, please reexplain what you are 
trying to achieve.

If you want to render one of your ZClass with <dtml-var myClass> you may 
need to subclass "Renderable BaseClass" (available on the Zope site).

Or I am barking up the wrong tree?


Alexandre


At 10:41 09/03/2000 -0800, you wrote:
>From: "Olivier Deckmyn" <odeckmyn.list@teaser.fr>
>Subject: [Zope] Methods in a Simple Class
>Date: Thu, 9 Mar 2000 18:48:41 +0100
>
>
>Hi all,
>
>I have built a trivial ZClass : CD (from CDProduct, from the guides).
>
>I try to add a DTML Method "render_short".
>This method would render the CD Instance on one short line.
>
>My ZClass has simple attributes (artist : string, title : string,
>description : text)
>
>I would like to be able to write this simple "render_short" DTML method like
>:
>
>
>Artist : <dtml-var artist>
>Title : <dtml-var title>
>Descr : <dtml-var description fmt="structured-text" newline_to_br>
>
>But when I insert a <dtml_var myCDInstance> in my index_html, I got a
>exception :
>
>Error Type: KeyError
>Error Value: artist
>
>There is no typo in my code...
>How can I access to my ZClass instance attribute from inside its methods ?
>
>
>Please help me :)
>
>Olivier