[Zope] Global variables in ExternalMethod modules
Dave Cinege
dcinege-mlists-dated-1107815961.0eaccb at psychosis.com
Wed Feb 2 17:39:12 EST 2005
You might want to do something like what's below and call GetDBC() upon every
EM entry. It will reuse the current connection if it's present, otherwise it
opens a new one.
kisSQL is my own module that wraps around mysql. What drove me crazy for a bit
and resulted in tons of hung db conenctions was I stupidly a forgot to put a
delete method in my kisSQL class. ( def __del__(self):) to actually close
the connections, as CloseDBC() would not always get called.
-------------------
def GetDBC ():
import kisSQL
global sql
if 'sql' not in globals():
sql = kisSQL.kisSQL(db=dbname,user=dbuser,passwd=dbpass)
def CloseDBC ():
global sql
if 'sql' in globals():
del(sql)
More information about the Zope
mailing list