mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
18 lines
428 B
Python
18 lines
428 B
Python
![]() |
from peeringdb_server.context import current_request
|
||
|
|
||
|
|
||
|
class CurrentRequestContext:
|
||
|
|
||
|
"""
|
||
|
Middleware that sets the current request context
|
||
|
|
||
|
This allows us to access the current request from anywhere we need to
|
||
|
"""
|
||
|
|
||
|
def __init__(self, get_response):
|
||
|
self.get_response = get_response
|
||
|
|
||
|
def __call__(self, request):
|
||
|
with current_request(request):
|
||
|
return self.get_response(request)
|