added saas shit

This commit is contained in:
Rudi Grinberg 2012-11-07 11:29:39 -05:00
parent af51ddca79
commit 110008e909
3 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,19 @@
import threading
tc = threading.local()
class InstanceThread(threading.Thread):
def __init__(self,user, *args, **kwargs):
super(InstanceThread, self).__init__(*args, **kwargs)
self._user = user
def run(self):
tc._user = self._user
def user(self):
return tc._user
class InstanceInheritingThread(threading.Thread):
def __init__(self, *args, **kwargs):
super(InstanceInheritingThread, self).__init__(*args, **kwargs)
self.user = tc._user