On Jul 8, 2008, at 2:31 PM, Phillip J. Eby wrote:
At 11:35 AM 7/8/2008 -0700, Donovan Preston wrote:
Obviously plenty of
people have a desire to have a place to store request-local data
without passing the environment everywhere. Using threading.local
is a
good way to do that, unless the server is not using one thread per
request. Giving people an interface to write to that doesn't
specifically mention threads and is customizable by the wsgi server
is
what I am suggesting.
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.
Donovan
_______________________________________________
Web-SIG mailing list
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe:
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com