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 31 32 33 34 35 36 37 38 39 40 41
|
Description: Fix middleware to be compatible with Django 1.10
Origin: upstream, https://patch-diff.githubusercontent.com/raw/kstateome/django-cas/pull/64.diff
Last-Update: 2019-04-11
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/cas/middleware.py
+++ b/cas/middleware.py
@@ -5,6 +5,15 @@ try:
except ImportError:
from urllib.parse import urlencode
+
+MIDDLEWARE_BASE = None
+
+try:
+ from django.utils.deprecation import MiddlewareMixin
+ MIDDLEWARE_BASE = MiddlewareMixin
+except ImportError:
+ MIDDLEWARE_BASE = object
+
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth import logout as do_logout
@@ -19,7 +28,7 @@ from cas.views import login as cas_login
__all__ = ['CASMiddleware']
-class CASMiddleware(object):
+class CASMiddleware(MIDDLEWARE_BASE):
"""
Middleware that allows CAS authentication on admin pages
"""
@@ -81,7 +90,7 @@ class CASMiddleware(object):
return None
-class ProxyMiddleware(object):
+class ProxyMiddleware(MIDDLEWARE_BASE):
# Middleware used to "fake" the django app that it lives at the Proxy Domain
def process_request(self, request):
|