[Zope] ZClasses and aquisition

Dieter Maurer dieter@handshake.de
Wed, 12 Sep 2001 22:35:29 +0200 (CEST)


Robert Rottermann writes:
 > I created a Zclass that renders some data and displayes it.
 > I use DTMLMethod as one of its base classes.
 > One of the classes methods is called index_html. This method calls the
 > rendering function.
 > So
 > http://..../myInstane
 > works fine.
 > However when I want to embed the output within an other page I either get
 > the wrong output, or an error.
 > 
 > using:
 > <dtml-var myclass> produces just the content of  the DTMLMetho (instead of
 > rendering it first).
Strange. Do not understand that....

 > <dtml-var expr="myclass.index_html()">
 > claimes that the rendering function I defined in the class are not defined.
That's clear. Standard error, done hundreds of times....

  "index_html" is a DTML Method, right?

  DTML Methods know about their context only if this information
  is passed explicitly!

  You call your "index_html" without any parameters.
  Hence, it does not know anything about its context.

You may use:

    <dtml-var expr="myclass.index_html(myclass,_)">


You may read

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>

to avoid standard errors....


Dieter