WARNING with import and threading.local(): they were hot topics on the pycon webdev summit, and other frameworks are facing problems with them.
They could be memory hungry and contention problems could arise, so they could have scalabillity issues too. I think the web2py way is not so bad, but we should find some way to cache the models. Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com