[Web-SIG] Alternative to threading.local, based on the stack
Robert Brewer
fumanchu at aminus.org
Wed Jul 9 00:19:15 CEST 2008
Donovan Preston wrote:
> On Jul 8, 2008, at 2:31 PM, Phillip J. Eby wrote:
> > Er, and how do you propose people *access* that interface rather
> > than a specific implementation of it? Wouldn't we need to pass it
> > in the environ, thereby rendering the whole thing even more
> > obviously moot? :)
>
> You're right. A standard specific implementation is what I am
> suggesting. Here, code should help:
>
>
> ## requestlocal.py
>
> ## use thread-local storage as the default
> from threading import local
>
> def set_local_implementation(imp):
> global local
> local = imp
>
>
> If a wsgi server wants to implement request-local storage by using the
> environ, it would call set_local_implementation with an imp function
> that closes over the environ for each request.
And what package does requestlocal.py live in?
Robert Brewer
fumanchu at aminus.org
More information about the Web-SIG
mailing list