[Twisted-Python] node with html content

Stephen Thorne stephen at thorne.id.au
Wed Sep 24 15:44:54 MDT 2003


suneetha at sonic.net wrote:

>Hi,
>   request.d.createTextNode(data) creates a text node and display the data
>in the browser. I wanted to return a node in generate() method, that
>display a web form instead of displaying the text. I created the node
>with html content(string). Since I used createTextNode method, it is
>displaying the html source instead of form. Is there any other method
>that creates this kind of Node? If not how do I slove this?
>  
>
Looking at twisted.web.woven.widgets.Text - if you want to return a node 
that contains 'Raw' text (i.e. text that doesn't need to be escaped - as 
in your case where you want to return form elements) you use

from twisted.web import domhelpers
textNode = domhelpers.RawText(data)
node.appendChild(textNode)

Does that answer your question.

I also highly recommend you have a good look at 'woven', and probably in 
your case specifically 'lmx'.

Regards,
Stephen Thorne







More information about the Twisted-Python mailing list