[Web-SIG] Alternative to threading.local, based on the stack

2008-07-04 Thread Iwan Vosloo
Hi, Many web frameworks and ORM tools have the need to propagate data depending on some or other context within which a request is dealt with. Passing it all via parameters to every nook of your code is cumbersome. A lot of the frameworks use a thread local context to solve this problem. I'm

Re: [Web-SIG] Alternative to threading.local, based on the stack

2008-07-04 Thread Martijn Faassen
Hi there, 2008/7/4 Iwan Vosloo [EMAIL PROTECTED]: [snip] A lot of the frameworks use a thread local context to solve this problem. I'm assuming these are based on threading.local. (See, for example: http://www.sqlalchemy.org/docs/05/session.html#unitofwork_contextual ) scoped_session is

Re: [Web-SIG] Alternative to threading.local, based on the stack

2008-07-04 Thread Manlio Perillo
Iwan Vosloo ha scritto: Hi, Many web frameworks and ORM tools have the need to propagate data depending on some or other context within which a request is dealt with. Passing it all via parameters to every nook of your code is cumbersome. A lot of the frameworks use a thread local context to

Re: [Web-SIG] Alternative to threading.local, based on the stack

2008-07-04 Thread Iwan Vosloo
On Fri, 2008-07-04 at 13:42 +0200, Manlio Perillo wrote: Iwan Vosloo ha scritto: Hi, Many web frameworks and ORM tools have the need to propagate data depending on some or other context within which a request is dealt with. Passing it all via parameters to every nook of your code is

Re: [Web-SIG] Alternative to threading.local, based on the stack

2008-07-04 Thread Martijn Faassen
Hey, On Fri, Jul 4, 2008 at 1:37 PM, Iwan Vosloo [EMAIL PROTECTED] wrote: On Fri, 2008-07-04 at 13:31 +0200, Martijn Faassen wrote: scoped_session is actually, I think, a bad example, as SQLAlchemy uses the thread id to scope things per session, not threading.local. As long as there's a way

Re: [Web-SIG] Alternative to threading.local, based on the stack

2008-07-04 Thread Manlio Perillo
Iwan Vosloo ha scritto: On Fri, 2008-07-04 at 13:42 +0200, Manlio Perillo wrote: Iwan Vosloo ha scritto: Hi, Many web frameworks and ORM tools have the need to propagate data depending on some or other context within which a request is dealt with. Passing it all via parameters to every nook

Re: [Web-SIG] Alternative to threading.local, based on the stack

2008-07-04 Thread Iwan Vosloo
On Fri, 2008-07-04 at 13:39 +0100, Matt Goodall wrote: Iwan Vosloo wrote: You're correct that Twisted Web does not allocate a thread per request. All requests are handled by an event loop in the main thread. In Twisted, the call stack tends to gets fragmented during a sequence of

Re: [Web-SIG] Alternative to threading.local, based on the stack

2008-07-04 Thread Benji York
On Fri, Jul 4, 2008 at 9:23 AM, Iwan Vosloo [EMAIL PROTECTED] wrote: On Fri, 2008-07-04 at 13:39 +0100, Matt Goodall wrote: The ideal solution is, of course, to pass everything around to whatever needs it. However, there's really tedious at times. Whatever the architecture of the web server

Re: [Web-SIG] Alternative to threading.local, based on the stack

2008-07-04 Thread Robert Brewer
Benji York wrote: On Fri, Jul 4, 2008 at 9:23 AM, Iwan Vosloo [EMAIL PROTECTED] wrote: On Fri, 2008-07-04 at 13:39 +0100, Matt Goodall wrote: The ideal solution is, of course, to pass everything around to whatever needs it. However, there's really tedious at times. Whatever the

Re: [Web-SIG] Alternative to threading.local, based on the stack

2008-07-04 Thread Ian Bicking
Iwan Vosloo wrote: Many web frameworks and ORM tools have the need to propagate data depending on some or other context within which a request is dealt with. Passing it all via parameters to every nook of your code is cumbersome. A lot of the frameworks use a thread local context to solve this