>
> Actually, if you do this at the module level (say in
> turbogears.database), you'll get threadlocal sessions automatically
> (this is the purpose of scoped_session -- see
> http://www.sqlalchemy.org/docs/04/documentation.html#unitofwork_contextual):
>
>     session = scoped_session(sessionmaker())
>
> session is now a class (ScopedSession) that will automagically create
> thread-local sessions for you to use with its classmethods (get,
> query, etc.).  It's never actually required that you instantiate the
> class to use it.  Since TG runs with a fixed thread pool, it would use
> session.close() at the end of each request to free up all the session
> resources.  Controllers that don't need the session don't use it, and
> don't incur much overhead (except for the initial creation of a
> session for each thread + a trivial amount in ScopedSession.close() )

Yes this is the conclusion we came to with Mark yesterday :-)
I'll review my options this week end in details and hack something in
the 1.1 branch...

Sorry I don't have much time to answer right now...

Florent.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to