|
VanL
vlindberg at verio.net
Thu Aug 7 09:04:51 EST 2003
Hello,
I am using quixote+mod_python as a front-end for a database app. Based
on the example in the faq, it looks like I could just make the
connection in a separate module and mod_python would automatically make
the database connections persist.
For example,
if I have code that is run by mod_python
=== persistdb.py ==================
import psycopg as db
def connect():
global connection
try:
conn = connection
return conn
except NameError:
connection = db.connect(connection_string)
return connection
=== application.py ==================
import persistdb
conn = persistdb.connect()
# Use conn here
From the FAQ, it appears that the db connection "connection" would
persist transparently. Is this a correct understanding?
If that is true, would there be any benefit to using dbpool, as opposed
to the code posted above?
Thanks,
VanL
|