[Zope] Evaluating dtml from python

Chuck Burdick (TT) chuck.burdick@tradingtechnologies.com
Mon, 20 Dec 1999 11:04:47 -0600


I have a string that I want to evaluate as dtml from within a python method.
How do I send the namespace to the HTML object so that it understands the
<dtml-var> tags?

<<<Example>>>

from Globals import HTML

def myproc
	mystring = "<dtml-in mysqlselect><dtml-var id>, <dtml-var
value></dtml-in>"
	mydtml = HTML(mystring, globals())
	return HTML.__call__()

<<<End of Example>>>

Right now when I call this from Zope, it will interpret standard HTML tags
just fine.  Zope appears to parse the dtml tags, but I'm getting a KeyError
on 'mysqlselect' which leads me to think that the HTML object does is not
inheriting (or otherwise receiving) the current namespace.

How do I pass the namespace?  Is there a better way to do what I want?

Thanks in advance,
Chuck Burdick

Web Administrator / Developer
Trading Technologies, Inc.

chuck.burdick@tradingtechnologies.com
(847) 424-8844