[Zope] Session and objects

Oliver Bleutgen myzope@gmx.net
Tue, 01 Oct 2002 14:40:27 +0200


Bo M. Maryniuck wrote:
> On Monday 30 September 2002 17:58, Oliver Bleutgen wrote:
> 
>>Do you want/have something like per-user persistent DB connections,
>>maybe with individual connection string (login/password)?
> 
> Yes, exactly. Any ideas? ;-)
> 

Hmm, I agree it may be nice to store the an instance of the Database 
Connection in a session. But generally I don't know what happens if the 
user has session cookies disabled (maybe you know that he hasn't 
anyway). I also have no idea why this isn't possible, because a new 
instance of a db-connection is not already stored in the "normal" ZODB.

Maybe, if you can afford it storage-wise, create normal db connections 
for every user and open/close them on demand. This (esp. the closing 
part) should be doable with what Jens said:

"there is methods in the sessioning machinery that allow you to do 
processing on session data that is about to expire."

So store the (relative) path to your db-connection objects in the 
session and close them if the session expires.

cheers,
oliver