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 p

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. > >> > >> Wha

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 we

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 > asynchr

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

2008-07-04 Thread Matt Goodall
Iwan Vosloo wrote: > 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 contex

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 of

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

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

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 so

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

2008-07-04 Thread Iwan Vosloo
Hi Martijn, 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 to uniquely identify "context", scoped_session > could also be

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

[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 assu