[mod_python] PSP Handler - related alternatives?

Eric Strand estrand at isomedia.com
Sun Jan 15 20:59:28 EST 2006


Hello,

I'm looking for a little advice from fellow mod_python users who use the 
PSP handler.

I'm using the PSP Handler, not so much to embed Python code within HTML, 
but to use the handler's feature of relating a URL to a specific file, 
and also its caching behavior so that an apache restart is not required 
when I edit a .psp file.

Most of my pages do not contain HTML what-so-ever, so the step of 
parsing a .psp file effectively just strips the enclosing <% and %> tags 
from around my Python code.  Though this happens only once per 
interpreter due to caching, it still seems inefficient to me.

I poked around the psp.py file and altered the PSP.load_from_file() 
function so that the source is read directly from a psp file, instead of 
returned from the parsing step.  This, and removing the <% %> tags from 
my PSP files, results in the same behavior as the original PSP.

Though this works just fine, I am not really using the PSP handler for 
it's intended use.  So I wonder whether there might be better techniques 
out there.  Primarily I just want to relate a URL to a file of python 
code used to generate a page.  Any comments are appreciated!

Thanks,
Eric


More information about the Mod_python mailing list