Skip to content

Commit

Permalink
use django MiddlewareMixin to support new style Middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Walter Renner committed Jan 26, 2018
1 parent e1c5835 commit e4d2ebe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hijack/middleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# -*- coding: utf-8 -*-
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
class MiddlewareMixin(object):
pass

class HijackRemoteUserMiddleware(object):

class HijackRemoteUserMiddleware(MiddlewareMixin):
"""
Middleware for hijack RemoteUser. One must place this middleware between
'django.contrib.auth.middleware.AuthenticationMiddleware' and
Expand Down
1 change: 1 addition & 0 deletions hijack/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'hijack.middleware.HijackRemoteUserMiddleware',
)

MIDDLEWARE_CLASSES = MIDDLEWARE
Expand Down

0 comments on commit e4d2ebe

Please sign in to comment.