[mod_python] PSP Templating

John Ruff jcruff at gmail.com
Thu Mar 1 09:40:16 EST 2007

I'm trying to understand what I'm doing wrong.  I'm using mod_python  
3.3.1 with apache 2.2.4.  The situation is that while trying to use  
PSP as a templating engine, none of the examples work.  Yet normal  
'SetHandler mod_python' with inline html works no problem.

I have the following:

<Directory "/home/<user-dir>/Sites/python">
     SetHandler mod_python
     PythonHandler mod_python.publisher
     PythonOption mod_python.psp.cache_database_filename "/tmp/ 
     PythonDebug On

from mod_python import apache, psp

def hello(req):
     s = 'Hello, there!'
     tmpl = psp.PSP(req, filename = 'hello.tmpl')
     tmpl.run(vars = {'greet':s})
     return apache.OK


Still, I'm presented with a webpage that's raw html of what would  
have been generated.  When using firefox's Web Developer toolbar to  
see the generated source I can see that my html has been surrounded  
by an '<html><head></head><body><pre>...</pre></body></html>' block.   
So it looks like this:


<html><head></head><body><pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD  
XHTML 1.0 Strict//EN"

&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"  
     &lt;meta http-equiv="Content-Type" content="text/html;  



     &lt;h1&gt;Hello, there!&lt;/h1&gt;


Any ideas why this is happening?
John Ruff
jcruff at gmail.com
GPG Key: 0x1F691195
FGPR: 6B50 37C9 10F9 6C4A D381  54B8 319D 7DD9 1F69 1195

"No one can see past a choice they don't understand." --The Oracle

More information about the Mod_python mailing list