[Zope] Using __repr__ and DocumentTemplates
Mike Pelletier
mike@compar.com
Thu, 11 Feb 1999 17:19:30 -0500 (EST)
I have an object I would like to be able to render with a DTLM tag like
this:
<!--#var my_object-->
I've done this before with __repr__, but this time I wanted to render the
object with a DTML file. I have a line like so in my object's class:
__repr__ = HTMLFile("template")
Right now the template.dtml file only contains the line:
<!--#var id-->
If I view a page which attempts to render an instance of this class, it
raises a KeyError, indicating that it doesn't know what 'id' in the DTML
refers to. If I change the line to:
repr = HTMLFile("template")
and view it explicitly from my browser, I get the results I am expecting.
What am I doing wrong here?
Thanks,
Mike.
--
--- | Mike Pelletier Work: 519-746-1607
/opeware! | Software Developer Home: 519-725-7710
--- | mike@zopeware.com Fax: 519-746-7566
http://www.zopeware.com | Zopeware is not endorsed by Digital Creations