I have a connection to an external resource that I need to make for my Pylons app (think along the lines of a database connection.) There is a modest amount of overhead involved in establishing the connection.
I could setup a piece of middleware that opens and closes the connection with every request but that seems wasteful. I'd like to establish a connection for each new thread that starts up and save myself the overhead. How do I hook into thread startup in Pylons?