[Zope] Using DTMLFile or PageTemplateFile in methods

Dieter Maurer dieter@handshake.de
Mon, 23 Jul 2001 22:28:24 +0200 (CEST)


Peter Bengtsson writes:
 > I also tried your advice::
 >   def index_html(self):
 >         " "
 >         # 'simple' only contains "<html>hello</html>"
 >         # call, call the PageTemplateFile() so that it returns HTML, not
 > object
 >         return PageTemplateFile('simple', globals()) ()
 > which gives me this error:
 > Error Type: AttributeError
 > Error Value: 'string' object has no attribute 'other'
 > 
 > 
 >   File C:\Program Files\zope\lib\python\Shared\DC\Scripts\Bindings.py, line
 > 351, in _bindAndExec
 >     (Object: simple)
 >   File <string>, line 1, in ?
 >   File C:\Program Files\zope\lib\python\Shared\DC\Scripts\Bindings.py, line
 > 304, in _getTraverseSubpath
 >     (Object: simple)
 > AttributeError: (see above)
The template want to be embedded into the Zope acquisition context:

Try:

	return PageTemplateFile('simple', globals()).__of__(self) ()


Dieter