File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 11from django .conf import settings
22from django .http import HttpResponse
33from django .utils .encoding import iri_to_uri
4+ try :
5+ # Django 1.10+
6+ from django .utils .deprecation import MiddlewareMixin
7+ except ImportError :
8+ # Before Django 1.9 and below
9+ class MiddlewareMixin (object ):
10+ pass
411
512from readonly .exceptions import DatabaseWriteDenied
613
@@ -17,7 +24,7 @@ def __init__(self, request):
1724 self ['Location' ] = iri_to_uri (referer or "/" )
1825
1926
20- class DatabaseReadOnlyMiddleware (django . utils . deprecation . MiddlewareMixin ):
27+ class DatabaseReadOnlyMiddleware (MiddlewareMixin ):
2128 def process_exception (self , request , exception ):
2229 # Only process DatabaseWriteDenied exceptions
2330 if not isinstance (exception , DatabaseWriteDenied ):
You can’t perform that action at this time.
0 commit comments