Source

ytmanager / mcutils / middlewares.py

Full commit
1
2
3
4
5
6
7
8
9
from django.utils.thread_support import currentThread
_requests = {}

def get_request():
    return _requests[currentThread()]

class GlobalRequestMiddleware(object):
    def process_request(self, request):
        _requests[currentThread()] = request