[mod_python] PSP returning empty result

Nicholas Piël nicholas at nichol.as
Fri Sep 28 14:50:27 EDT 2007


Mod_Python: 3.3.1 (also tried 3.2.0)
Debian EDGE (stable and up2date)
Apache 2.2.3 (32bit, Prefork)
Python 2.5

Hi,

When trying to run some old code  which worked ok on mod_python 3.1  
on a different server i bumped into a problem that got me stumped.

On this new server i am unable to render any PSP templates from  
within the Apache environment, however trying to parse the template  
from the prompt works fine (_psp.parse(filename)).

My configuration is as below, I tried different mod_python versions  
but they all behave the same way. When i open "...bla.py/weird" in a  
browser it does indeed return 'weird!' so the error really seems to  
be in the rendering of the template. I checked my error logs and it  
does not contain any error message. The result of both handlers/ 
controllers (index, test) is just an empty page. In the test handler  
i can only see a single 0. Presumably coming from 'return apache.OK'.

When i change the Python handler to mod_python.publisher and directly  
open the .psp file it also returns an empty page. When i append the  
underscore all that it returns is: " PSP-produced Python Code:  /var/ 
www/web1/web/test/bla.psp: "


Does anyone have suggestions to tackle this problem?

Cheers,
Nicholas


----8<------   My .htaccess

SetHandler mod_python
PythonHandler mod_python.publisher
PythonDebug On



----8<------ My bla.py

from mod_python import apache, psp

def index(req):
         tmpl = psp.PSP(req, filename='/var/www/web1/web/test/bla.psp')
         tmpl.run()

def weird(req):
         req.write("weird!")

def test(req):
         req.write(str(psp.parse("/var/www/web1/web/dalgarno/bla.psp")))
         return apache.OK


----8<------ My bla.psp

<html>
<body>
      <h1> bla test</h1>

      bla test

      </body>
</html>





More information about the Mod_python mailing list