def __init__(self, *args, **kwargs):
class LocalContexts(threading.local):
def __init__(self):
super(LocalContexts, self).__init__()
self._contexts = []
def append(self, item):
self._contexts.append(item)
def pop(self):
return self._contexts.pop()
super(ThreadSafeStackContext, self).__init__(*args, **kwargs)
if hasattr(self, 'contexts'):
# only patch if context exists
self.contexts = LocalContexts()
request_context.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录