[mod_python] Persistent objects in sub-interpreters

Sidney Cadot sidney.cadot at jigsaw.nl
Sun Mar 23 22:57:10 EDT 2008

Hi all,

The whole "raison-d'etre", if you pardon my french, of modpython is to
enable persistent (across request) objects like database connections, in
order to dramatically improve performance compared to solutions where each
request invokes a new interpreter, database connection, etc. At least that's
what I gather from the documentation.

However, I cannot find a documented way of holding objects for reuse between
requests to the same Python subinterpreter instance. (Perhaps I just missed

How is this done? E.g. how would I make a handler that counts the number of
invocations of itself by storing an integer in the context of its own

Then, how do I build a persistent database connection on top of that?

Regards, Sidney

More information about the Mod_python mailing list