[mod_python] PSP imports

Dan W. dwmp at opti.cgi.net
Mon Nov 24 23:43:01 EST 2003


At 12:22 AM 11/25/2003 -0500, you wrote:

>On Mon, 24 Nov 2003, Dan W. wrote:
>
> > It appears as though the PSP module doesn't check dependencies for
> > modification times.  If I create a module and reference it from a PSP
> > page and make a request for the page, then I change the module and make
> > a second request the module is not reloaded.  Has this been overlooked
> > or is this a 'feature'?
>
>it's a feature of Python (not mod_python) ;-)
>
>if you want the module properly reloaded when it changes, import it like
>this:
>
>mymodule = apache.import_module('mymodule')

Ahhh, Ok.  I guess that means I can't use the form:

from mypackage.mymodule import *


I have not yet familiarized myself with the source enough to say, but it 
would be nice to have a command which when supplied at the beginning of a 
PSP file would tell it to autoreimport.  Maybe something like:

<%
psp.autoreimport(true)
%>
<html>
...

I've played around with replacing the builtin _import with a home grown 
import function to do just this in a different project.  Perhaps it could 
be done here too.  Perhaps after I become more familiar with the source 
I'll be able to help out to that end.



> > Also, it appears as though the PSP module prefers to store its cached
> > compiled code in a DBM file instead of memory.
>
>Not unless you tell it so. By default it's memory.
>
>http://www.modpython.org/live/mod_python-3.1.2b/doc-html/pyapi-psp.html


Sorry, I must have read the source wrong.  I'll have to take another look.

-Dan



More information about the Mod_python mailing list