[Zope] ZClass derrived from Image does not call "view" from within <dtml-var>

Stefan H. Holek stefan@epy.co.at
Mon, 16 Oct 2000 10:40:17 +0200 (CEST)


On Sun, 15 Oct 2000, Noah wrote:

> I'm a Zope beginner. I'm trying to create an ImageTemplate ZClass. This will work
> similar to an Image, but the user can insert it directly in DTML using <dtml-var MyImage>
> and it will get expanded into HTML (with formatting, <img> tag, caption, etc.)

FWIW the Image object does exactly that already.

> 2. The Publisher does not call the view method (index_html) of the object!
> Instead it calls str() which is __str__ in Image and that calls Image.tag().
> I can't overload __str__ because Zope does not allow a method to start
> with _ underscore.

This is the way it works! For creating ZClasses that render on __str__
see http://www.zope.org/Members/lalo/Renderable-ZClass

HTH
Stefan