blob: fdb08a81fba45bb9ac4e1f6c9130f18ebf538e40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
from core.models import Config
class AlwaysSecureMiddleware:
"""
Locks the request object as always being secure, for when it's behind
a HTTPS reverse proxy.
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
request.__class__.scheme = "https"
response = self.get_response(request)
return response
class ConfigLoadingMiddleware:
"""
Caches the system config every request
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
Config.system = Config.load_system()
response = self.get_response(request)
return response
|