mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
* module docstrings * db schema graph * dev docs first pass * dev docs pass 2 * add generated notification to top of generated docs files * linting * regen docs Co-authored-by: Stefan Pratter <stefan@20c.com> Co-authored-by: Sunshine Buchholz <sunshine@20c.com>
22 lines
451 B
Python
22 lines
451 B
Python
"""
|
|
Custom django middleware.
|
|
"""
|
|
|
|
from peeringdb_server.context import current_request
|
|
|
|
|
|
class CurrentRequestContext:
|
|
|
|
"""
|
|
Middleware that sets the current request context.
|
|
|
|
This allows access to the current request from anywhere.
|
|
"""
|
|
|
|
def __init__(self, get_response):
|
|
self.get_response = get_response
|
|
|
|
def __call__(self, request):
|
|
with current_request(request):
|
|
return self.get_response(request)
|