[zope-dev] Using db_connections from Zope products

William Noon noon@snow.cit.cornell.edu
Wed, 20 Jun 2001 16:20:35 -0400


In both products and External methods I do something like the following:

def get_product(self, trans_id) :
	database = getattr(self, 'product_DA')    # product_DA is the database
	res = database().query(                   #  adaptor
		"select * from product_log where trans_id = '%s';"%(trans_id))
	
	fields = res[0]
	results = res[1]


This allows the database adaptor to pool connections and be setup
from the zope management screens.

--Bill Noon