Graham Dumpleton
grahamd at dscpl.com.au
Fri Aug 5 20:13:08 EDT 2005
On 06/08/2005, at 10:06 AM, Scott Chapman wrote: > Graham Dumpleton wrote: > > Since to get the server object you need a request object, the only >> option is to call it as a side effect of a request. To avoid calling >> it >> more than once, you simply need to keep a global data flag some where >> which you can set the first time you register the cleanup handler >> thereby avoiding calling it again. > > Is there any way to store something global in memory on a per-child > basis, rather than in a session (which goes out to a dbm file)? You could still use a module imported using PythonImport for that purpose. What you probably want to do is used PythonImport like you were before but don't have it trigger the connection to the database system. When a call comes into access the database via that module later on, use your flag stored as global data in that module or in your database connection object to check at that point. If first time, connect to database and register cleanup handler. BTW, almost have a working version of apache.register_cleanup() going anyway if you want to try it when I am done. Means modify mod_python source though. Graham
|