[Zope] DTML rendering from python?

Michiel Toneman michiel@ylnd.com
24 Jan 2003 15:14:46 +0100


Solved!!!! :)

Thank you all for the great help. The Zope community really rocks! 

This is what I ended up doing:

--------------------------------------------
from OFS.DTMLMethod import DTMLMethod

.....snip.....

    def getHTML(self):
        "Returns HTML for page"

        .....snip.....

        html = dom.toxml() 
        return self.renderstring(html.encode('utf-8'))

    def renderstring(self, str, ns={}, REQUEST=None):
        m = DTMLMethod(str, REQUEST)
        return m(self, ns)
--------------------------------------------

Works like a charm :-)

I can now let a content manager edit the pages using structured-text,
control the rendering to HTML, do arbitrary DOM transforms on the HTML,
(which in this case is incorporating floating boxes into the HTML flow
at specified points) and finally render the whole thing as a DTML
document. I'm soooooooo happy :-D

Dieter: I'll have a look at the method you suggested as well. It seems
quite similar in approach.

Again thank you all for the great help and support. 

Greetings,

Michiel