[mod_python] Using a psp parser from outside mod_python

Jim Gallacher jg.lists at sympatico.ca
Thu Jun 23 13:28:58 EDT 2005


dharana wrote:
> Hello list,
> 
> If I try to:
> 
>     from mod_python.psp import PSP
> 
> from a cmdline python script I get "ImportError: No module named 
> _apache". I'm dynamically generating psp templates (mixes of xhtml and 
> <% %> tags) that need to be parsed into full xhtml from a non-apache 
> env. Is there any possibility of using PSP this way?
> 

A quick look at psp.py indicates that the _apache module (which is only 
available within the apache) is used for acquiring a global lock on the 
dbm file used for caching psp pages.

It should be easy to adapt psp.py to implement your own locking scheme, 
or eliminate locking altogether if you are generating your pages in a 
single process.

And I'm sure you've already figured out that you'll need to simulate the 
request object.

Regards
Jim



More information about the Mod_python mailing list