summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2016-10-21 21:21:07 +0200
committerArmin Ronacher <armin.ronacher@active-4.com>2016-10-21 21:21:07 +0200
commite2fc94bcb50988c04821f1091fab09d51352f05a (patch)
treea9016a9abbd06d3e0bcf01b469b33cbf2c050953
parent9cc4c95c242eb7eb0d57ffcdecc8dd3594d3b4b7 (diff)
downloadraven-e2fc94bcb50988c04821f1091fab09d51352f05a.tar.gz
Correctly fixed #886
-rw-r--r--raven/contrib/django/middleware/__init__.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/raven/contrib/django/middleware/__init__.py b/raven/contrib/django/middleware/__init__.py
index 1ecec8d..43b061f 100644
--- a/raven/contrib/django/middleware/__init__.py
+++ b/raven/contrib/django/middleware/__init__.py
@@ -78,7 +78,16 @@ class SentryResponseErrorIdMiddleware(MiddlewareMixin):
return response
-class SentryMiddleware(threading.local):
+# We need to make a base class for our sentry middleware that is thread
+# local but at the same time has the new fnagled middleware mixin applied
+# if such a thing exists.
+if MiddlewareMixin is object:
+ _SentryMiddlewareBase = threading.local
+else:
+ _SentryMiddlewareBase = type('_SentryMiddlewareBase', (MiddlewareMixin, threading.local), {})
+
+
+class SentryMiddleware(_SentryMiddlewareBase):
resolver = RouteResolver()
# backwards compat