blob: 1401cd673235426723b01ca1e7fc6d104de8d301 [file] [log] [blame]
from threading import local
_active = local()
def get_request():
if not hasattr(_active, "request"):
raise Exception("Please add 'core.middleware.GlobalRequestMiddleware' to /opt/planetstack/planetstack/settings.py:MIDDLEWARE_CLASSES")
return _active.request
class GlobalRequestMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
_active.request = request
return None