[mod_python] Best practices for coding in mod_python?

Steve Bergman steve at rueb.com
Fri Sep 16 15:07:13 EDT 2005


I'm new to mod_python and mediumly new to python, as well.  I really 
like what I see.  The python philosopy of  of simplicity and clarity 
really appeals to me.

However, I'm a little frustrated, partly because I'm still at the stage 
that I have to go to the reference manuals every 2 or 3 lines of code.

However, I am working on rewriting a php application in mod_python as a 
learning project.  I'd like it to come out well enough that I can 
actually replace the php version with the mod_python version after I'm done.

There are a number of things related to my general approach of which I 
am uncertain.  e.g. I'm using publisher.  I think that is the right 
choice, but I'm not sure.  Then there are lots of things involving 
coding techniques and style of which I am uncertain.  e.g. for a funtion 
or method to write something to the browser, the return value has to 
propagate back up to main and get returned from their, right?  Or it 
just occurred to me I might could use req.write()?  But is that a good 
thig to do?  If so, when.

It's not so much that I have not found ways to do what I want to do, but 
I'm uncomfortable with my style and technique.

There seems to be something of a dearth of books with titles like: 
Writing Beautifully Coded Web Applications With Mod_PHP and PostgreSQL".

Does anyone have any recommendations as to sources of solidly coded 
mod_python apps to review.  Or perhaps a good tips and tricks document?

Thank you for any advice,
Steve Bergman

(And thanks Jason and Jim for your help on my session handling question.)


More information about the Mod_python mailing list