Graham Dumpleton
graham.dumpleton at gmail.com
Wed Aug 12 21:05:12 EDT 2009
2009/8/13 Jon Rascal <jonrascal at gmail.com>: > Hi, > > I'm using mod python in the fixuphandler phase before the content (generic) > handler takes charge and wondering what's the best way to open a persistent > connection to the database or LDAP server? How you open it is up to the Python module you are going to use to connect to them. As to retaining the connection, you would want to store it in a Python module which is NOT subject to reloading by mod_python. Thus, should be outside of document directories and not be in the handler code file. Thus, in a module that only appears on Python sys.path. Read: http://www.dscpl.com.au/wiki/ModPython/Articles/TheProcessInterpreterModel http://www.modpython.org/live/current/doc-html/pyapi-apmeth.html The latter to read about mod_python import_module() function and 'import' overlay. You do not want to store it in a code file managed by this mod_python module importer. Graham
|