[Twisted-web] Nested templates?

Donovan Preston dp at ulaluma.com
Thu Jul 7 20:40:27 MDT 2005


On Jul 7, 2005, at 9:22 AM, Alberto Trujillo wrote:

> There is any way to use nested templates without mix the python  
> code with the html code.
> I know, that I could solve this problem using Stan, or just writing  
> html code inside the python file and after display what I want.
> But that are exactly the option that I can't use. I have to nest  
> the template keeping the html code and the python code in different  
> file.
> If some body can give a example, a tutorial, a address, o something  
> that can help me, I'll be very pleasant.
>
> Thank you very much

It's not very hard. There is a class in nevow.rend specifically for  
this purpose, nevow.rend.Fragment. It is one of Page's superclasses.  
It doesn't do much but load a docFactory and render it. Here is an  
example of using it.

Let me know if this isn't enough help.

Donovan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: subtemplate.tac
Type: application/octet-stream
Size: 631 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20050707/6ad44bac/subtemplate.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Main.xml
Type: text/xml
Size: 297 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20050707/6ad44bac/Main.xml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sub.xml
Type: text/xml
Size: 117 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20050707/6ad44bac/Sub.xml


More information about the Twisted-web mailing list