Re: Best way to persist a DB or LDAP connection
Graham Dumpleton <[email protected]> Thu, 13 Aug 2009 11:05:12 +1000
| Newsgroups | gmane.comp.python.mod_python |
|---|---|
| Message-ID | <[email protected]> |
2009/8/13 Jon Rascal <[email protected]>: > 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