I'm using DB-API in my Pylons app as described in on this wiki page.
http://wiki.pylonshq.com/display/pylonscookbook/Using+the+DB-API+in+Pylons
The gist of which is to add the following to lib/app_globals.py
from pylons import config
import psycopg2
from DBUtils.PooledDB import PooledDB
class Globals(object):
def __init__(self):
self.pool = PooledDB( psycopg2, 5,
database=config['app_conf']['pool.database'],
user=config['app_conf']['pool.user'],
host=config['app_conf']['pool.host']
)
then in a controller you can get a connection with conn = g.pool.connection()
How would I do the equivalent with Pyramid?
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.