You can put the connection into a global/module variable and pick it up
later
import myConfiguration
def awake:
if myConfiguration.dbConn.has_key(self.session().sessionID)
self.conn = myConfiguration.dbConn[self.session().sessionID]
else:
myConfiguration.dbConn[self.session().sessionID] =
myConfiguration.MakeNewConnection(self.session().userName)
Of course the first time I tried it under load I quickly found out that
my session teardown code was not
actually closing the sessions..... (But I did find out that postgres can
support a few hundred connections on a PIII....)
-Aaron
Frank Barknecht wrote:
>Hallo,
>sandra ruiz hat gesagt: // sandra ruiz wrote:
>
>
>
>>I am working with webware-webkit 0.8, postgres 7.3 and pypgsql
>>
>>I am keeping the connection to the database in the object session of
>>Webware but i've got a problem.
>>
>>
>
>I don't think, a DB connection is pickleable, so you shouldn't do this
>in a session anyway. Only put things that can be pickled into a
>session.
>
>ciao
>
>
|