[mod_python] psp templates problem

Bjorn Sundberg sundberg.bjorn at gmail.com
Mon Nov 14 19:48:33 EST 2005


Hello i'm quite new to mod_python. I've read the documents on the net and i
found that the templating system is quite interesting. My problem is that
i'm trying to load dynamic data in a template. And when the program runs it
loads and repeat the template file and the variables that i want to change.
So far so good, but i'm only intrested in changing the psp variables in the
file. It seem's that i is not possible to use the <%# Stop %> to prevent the
<p> to repeat. Any body that have any ideas? Thanks in advance.

Regards
Björn S
--Code--
#!/usr/bin/env python
from mod_python import psp

def index(req):
req.add_common_vars()
req.content_type='text/html;charset=utf-8'
tmpl = psp.PSP(req, filename='3-2.html')
for key in req.subprocess_env.keys():
tmpl.run(vars = {'key': key, 'env': req.subprocess_env[key]})
--end--
---template---
<html>
<head>
<title>
3-2.py
</title>
</head>
<body>
<table >
<td><%=key %></td>
<td><%=env %></td>
</tr>
</table>
<p>test</p>
</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20051115/21799ff8/attachment.html


More information about the Mod_python mailing list