[Zope] Evaluating a string of DTML code?

Dieter Maurer dieter@handshake.de
Thu, 3 Aug 2000 23:03:00 +0200 (CEST)


T.J. Mannos writes:
 > I have an ExternalMethod that processes an HTML file, extracts the contents
 > of the BODY tag, and wraps my site template around it.  (In other words, it
 > takes a plain vanilla HTML file and adds standard_html_header and
 > standard_html_footer).
 > 
 > [See http://www.zope.org/Members/unfo/howto_wrapper/index_html for more
 > background]
 > 
 > The problem is this: I can't have arbitrary DTML code in the HTML file.
 > Zope completely ignores it.  I tried fmt=structured-text, but that doesn't
 > work, either.  Since the file is essentially read in as a string, is there
 > any way to evaluate an arbitrary string of DTML code?
What prevents you, to render the body? This should handle
DTML expansion, at least for simple cases.

	def wrap(self,what):
	    REQUEST= self.REQUEST
	    return self.standard_html_header(self,REQUEST) \
	           + what(self,REQUEST) \
		   + self.standard_html_footer(self,REQUEST)

This will break, if one of the DTML objects needs arguments
not present in the current REQUEST.


Dieter