1 """Python 2.3 compatabilty"""
4 class threadlocal(object):
5 """Implementation of threading.local for python2.3.
7 def __getattribute__(self, name):
9 return threadlocal._getd(self)
12 return object.__getattribute__(self, name)
13 except AttributeError:
15 return self.__dict__[name]
17 raise AttributeError, name
19 def __setattr__(self, name, value):
20 self.__dict__[name] = value
22 def __delattr__(self, name):
24 del self.__dict__[name]
26 raise AttributeError, name
29 t = threading.currentThread()
30 if not hasattr(t, '_d'):
31 # using __dict__ of thread as thread local storage
35 # there could be multiple instances of threadlocal.
41 if __name__ == '__main__':