[mod_python] templating for newbie

Claudio realtega at gmail.com
Wed Jul 6 04:10:56 EDT 2005


Hi,

I'm using the publisher handler. I'm trying to create a nested template
but I don't know how can I do it.

This is the code of the .py file

from mod_python import psp, apache
	
def index(req, name=''):
	
	
	req.content_type = "text/html"
	req.send_http_header()
	
	d = {}
	d = {'name': 'First'}
	
	
	
	filtri_tmpl = psp.PSP(req, filename='filtri.tmpl', vars = d)
	
	
	form_tmpl = psp.PSP(req, filename='form.tmpl')
	
	
	form_tmpl.run(vars = {'filtri_tmpl': filtri_tmpl })

	return

This is the form.tmpl

Lista dei filtri da poter settare

<FORM action="" method="POST">
  

<TABLE>
<%= filtri_tmpl %>


<TD><INPUT type="reset" name="reset" value="Reset"></TD>
<TD></TD>
<TD><INPUT type="submit" name="invia" value="Invia"></TD>
</TABLE>

</FORM>

This is the filtri.tmpl

<TR>
<TD>Nome filtro</TD>
<TD><%= name %></TD>
</TR>


How can I fill the form.tmpl with more than one elements like
filtri.tmpl? As example... a list of name?

Thank you




More information about the Mod_python mailing list