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 4
4
from django .utils .translation import get_language
5
5
from threading import local
6
6
7
+ try :
8
+ from django .utils .deprecation import MiddlewareMixin
9
+ except ImportError :
10
+ # Not required for Django <= 1.9, see:
11
+ # https://docs.djangoproject.com/en/1.10/topics/http/middleware/#upgrading-pre-django-1-10-style-middleware
12
+ MiddlewareMixin = object
13
+
7
14
8
15
__all__ = ['get_current_locale' , 'LocaleMiddleware' ]
9
16
@@ -19,7 +26,7 @@ def get_current_locale():
19
26
return getattr (_thread_locals , 'locale' , None )
20
27
21
28
22
- class LocaleMiddleware (object ):
29
+ class LocaleMiddleware (MiddlewareMixin ):
23
30
24
31
"""Simple Django middleware that makes available a Babel `Locale` object
25
32
via the `request.locale` attribute.
You can’t perform that action at this time.
0 commit comments