[Zope] DTML rendering from python?

Dario Lopez-Kästen dario@ita.chalmers.se
Fri, 24 Jan 2003 13:20:59 +0100


there is a recipe on ZopeLabs that I wrote, that takes a piece of text and
renders is as if it where DTML:

http://www.zopelabs.com/cookbook/1011691351

"This is a simple way of rendering strings as if
they where DTML from PythonScripts.

Sometimes you might need to generate DTML code or,
as is my case, you store all your content in a external
datastore (like a RDBMS) and oly have access to your
code in textual format. "

Should be trivial to adapt to standar Python for use in a Product.

Hope this helps,

/dario

----- Original Message -----
From: "Dylan Reinhardt" <zope@dylanreinhardt.com>
To: "Michiel Toneman" <michiel@ylnd.com>
Cc: <zope@zope.org>
Sent: Thursday, January 23, 2003 11:08 PM
Subject: Re: [Zope] DTML rendering from python?


> At 10:39 AM 1/23/2003, Michiel Toneman wrote:
> >There is something odd going on in my product though. I tried a
> >different approach to the problem and managed to write the finished DTML
> >source into a standard PropertySheet text-property. Now I rendered that
> >variable in a seperate and standard DTML Document like:
> >
> ><dtml-with "MyCMFolder.MyProductInstance">
> >   <dtml-var rendered_html>
> ></dtml-with>
> >
> >And the dtml in "rendered_html" doesn't expand/render either.
>
> By that, do you mean you get back the DTML code from rendered_html?
>
> If so, try:  <dtml-var "rendered_html">
>
> If that's not it, you might want to re-post this issue with a new subject
> and some additional detail about where the relevant objects are in your
ZMI.
>
> HTH,
>
> Dylan
>
>