new question
[edumed.git] / wtem / middleware.py
1 try:
2     from threading import local
3 except ImportError:
4     from django.utils._threading_local import local
5
6
7 _thread_locals = local()
8
9 def get_current_request():
10     return getattr(_thread_locals, 'request', None)
11
12
13 class ThreadLocalMiddleware:
14     def process_request(self, request):
15         _thread_locals.request = request