[Zope] how to render dtml-var

Casey Duncan cduncan@kaivo.com
Fri, 15 Jun 2001 09:36:24 -0600


Robert Rottermann redCOR AG wrote:
> 
> Hi there,
> I have an external function that returns a <dtml-var URL1> amongst a string
> of other code. Now I would like to have this variable rendered. How can I do
> that?
> 
> Thank you for your time
> Robert
> 

So what you mean is that an external method returns a string containing
DTML code that you want to render?

In that case, you would need to create another external method that
takes the string, creates a DTML object out of it and execute the object
something like: (untested):

from OFS.DocumentTemplate.DT_HTML import HTML

def execDTML(DTML, namespace=None, **kw):
	ob = HTML(DTML)
	return ob(namespace, kw=kw)

You would however not want to allow users to execute this directly from
the web, or you will open up a big security hole. I would recommend
restricting this to be executable by only a manager and use proxy roles
on any objects that call it.

hth,
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>