[Zope-dev] Question about _v_ attributes and database connections

Chris Withers lists at simplistix.co.uk
Thu Mar 11 06:49:34 EST 2004


Marco Bizzarri wrote:

>  I'm trying something inspired to that at the moment... I succeeded in
>  installing an hack, very inspired from your code (but at a much simpler
>  level) and some code in the SecurityManager,

?!

>  where I mantain a dictionary
>  of connections, indexed by the result of thread.get_ident(). 

:-(

>  Once a
>  thread needs a new connection, either it is present in the dictionary
>  or not. If it is present, give it to the thread and assign that to the
>  _v_database_connection attribute. Otherwise, create a new one, put in
>  the dictionary, and go on as before.

When do these connections get closed?

>  Of course this is a (horrible) hack, because if you have more than one
>  ZPsycopg objects you will end with mixed connections (aaaaargh!)

Indeed.

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




More information about the Zope-Dev mailing list