[mod_python] PSP imports

Dan W. dwmp at opti.cgi.net
Tue Nov 25 01:04:22 EST 2003

At 10:43 PM 11/24/2003 -0800, you wrote:
>Dan W. wrote:
>>That's a good point Michael.  That was probably a bad habit to pick up.
>>However, I think a overloaded import could still be useful.  Overloading 
>>the builtin import would allow a PSP file to control autoreloading for 
>>its entire dependency tree (modules which call other modules, etc.).
>>This would allow one to easily turn autoreloading on during development 
>>and to easily turn it off for production deployment.
>Consider that you might want not to use PSP.  I've actually found that it 
>gets in the way of the separation of code and content, which is important 
>when the designer and the coder are two different people.
>I design my mod_python apps like so:
>template = """
>def handler(req):
>    # Reload modules here if necessary
>    # Code goes here
>    # If you want to override the template, you can fetch it from the file
>    # system
>    req.write(template % vars())
>Of course, if you're already married to the PSP solution, then there you
>have it...

Thanks for the advice.  I'm not married to anything yet.  I'm moving from 
an in-house Python based application server to mod_python and PSP just 
seemed like the a natural move.  My plan was to build most of the dynamic 
code in python modules and then simply insert html into the templates with 
PSP expression syntax.  I can see where writing my own handler for these 
things would have advantages, but on the other hand I don't want to 
reinvent the wheel.  I'll play with that a bit.


More information about the Mod_python mailing list