tags:

views:

77

answers:

2

It seems like threading.local is more straightforward and more robust.

+1  A: 

Because threading.local is new in Python 2.4. The StackedObjectProxy uses threading.local if it can.

THC4k
Python 2.4 came out in 2004 so I'm not sure "new" is the right word.
Dave Webb
I'm just kind of quoting http://docs.python.org/library/threading.html#threading.local ;-)
THC4k
+1  A: 

StackedObjectProxy uses a threading.local underneath it. Pylons doesn't use plain threading.locals for 2 reasons:

1) it'd be a more intrusive API than a proxy. E.g. request().POST.get('file') vs request.POST.get('file')

2) StackedObjectProxys are not only thread safe, but also "request safe" -- meaning it's safe for a Pylons application to be embedded in another and reference the same proxy objects. The need for this kind of safety is rare, but is certainly a possibility with how easy it is for WSGI apps to call other WSGI apps + the use of global objects

See the paste.registry docs for more information

Philip Jenvey