[Zope-dev] Can't get ZClass baseclass to behave as DTML Method

Evan Simpson evan@4-am.com
Wed, 08 Sep 1999 18:32:48 -0500


Martijn Faassen wrote:

> Hi there again,
>
> Python and DTML Methods, one way or another they seem to be the theme
> for me today..
>
> A couple of weeks ago I asked the same question (I encountered it in
> different circumstances). I'm trying to create a ZClass (deriving from a
> Python base class) that behaves like a DTML _method_.
>
> To this purpose, I tried to define this __call__:

[snip]

> instead it'll display index_html (that is acquired and not defined on
> the ZClass). It apparently isn't calling __call__ at all.

Zope checks an object for 'index_html' *before* '__call__', so if your
object can acquire one, that's what will get rendered.  To prevent that,
you can do what the DTML objects do, and set index_html to None.

If you *can* do that with a ZClass.  Hmm.  Well, hopefully, this'll lead
you in the right direction.