1
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
2
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
7
# No threads, so "thread local" means process-global
12
local = threading.local
13
except AttributeError:
14
# Added in 2.4, but now we'll have to define it ourselves
19
self.__dict__['__objs'] = {}
21
def __getattr__(self, attr, g=thread.get_ident):
23
return self.__dict__['__objs'][g()][attr]
26
"No variable %s defined for the thread %s"
29
def __setattr__(self, attr, value, g=thread.get_ident):
30
self.__dict__['__objs'].setdefault(g(), {})[attr] = value
32
def __delattr__(self, attr, g=thread.get_ident):
34
del self.__dict__['__objs'][g()][attr]
37
"No variable %s defined for thread %s"