[mod_python] Persist database conn, or pers. variables - where I put them ?

durumdara durumdara at gmail.com
Wed Sep 27 10:13:17 EDT 2006

Sean Davis írta:
> On Wednesday 27 September 2006 09:16, Fredrik Sandin wrote:
>> I asked the same question some time ago:
>> http://modpython.org/pipermail/mod_python/2006-August/021924.html
>> Graham Dumpleton suggested to use XML-RPC.
>> As far as I have understood mod_python, or actually Apache, was
>> not designed to allow for object persistency.
> Is this actually true (at least the Apache part)?  Under mod_perl (I'm a 
> mod_python total newbie), object persistence can be accomplished in several 
> ways including global variables that remain in shared memory (but this is 
> only within a single child), a database, in an in-memory or on-disk cache, or 
> in a session (just an interface to a cache or database).  Depends on your 
> definition, but Apache, it seems to me, is absolutely suited to allow object 
> persistence.
> Sean
That was I thought too when I read your mail.
In PHP, Perl, the mod_* interface supports some possibility for the 
persistency - see the database connections.

I don't understand the whole thing.
As  I know the Python code is running in a subinterpreter that started 
by a server subprocess.
What I see in the experience:
When I import some module with import * (normal, pythonic way), this 
module not reloaded, so can hold some static (persistent) values.
I don't know, when this module destroyed - on number limitation of 
requests, on time limit, on subprocess dying, on Apache dying - I don't 
Also I don't know, the apace.import_module destroy the module variables 
on reload, or not.

But this working mode is confuse me, because I don't know, where I store 
the database connections. Ok, another things I hold in session, or db, 
or dbm, but these objects not serializable.

So: I don't think that does not exists a mechanism in mod_py that 
determine, what sections are persistent, and what are not...
In Zope same thing exists: a db connection holder (DataBase Adapter), 
and other thing are reloaded on requests.

Anyone can help me ?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060927/6c17e892/attachment.html

More information about the Mod_python mailing list