perf: 优化middleware的使用 (#4707)

perf: 优化middleware的使用
This commit is contained in:
fit2bot
2020-09-27 14:34:05 +08:00
committed by GitHub
parent 82de636b5c
commit d4037998c8
5 changed files with 24 additions and 3 deletions

View File

@@ -0,0 +1,10 @@
from django_cas_ng.middleware import CASMiddleware as _CASMiddleware
from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
class CASMiddleware(_CASMiddleware):
def __init__(self, **kwargs):
super().__init__(**kwargs)
if not settings.AUTH_CAS:
raise MiddlewareNotUsed