mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-22 15:21:01 +00:00
8f57aa5f37
Redoes the UI to remove timelines, promote domains, and a lot of other things to support the refactor.
17 lines
477 B
Python
17 lines
477 B
Python
from users.models import Domain
|
|
|
|
|
|
class DomainMiddleware:
|
|
"""
|
|
Tries to attach a Domain object to every incoming request, if one matches.
|
|
"""
|
|
|
|
def __init__(self, get_response):
|
|
self.get_response = get_response
|
|
|
|
def __call__(self, request):
|
|
request.domain = None
|
|
if "host" in request.headers:
|
|
request.domain = Domain.get_domain(request.headers["host"])
|
|
response = self.get_response(request)
|
|
return response
|