[mod_python] templating for newbie

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


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"
	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 })


This is the form.tmpl

Lista dei filtri da poter settare

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

<%= filtri_tmpl %>

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


This is the filtri.tmpl

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

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