Permalink
Browse files

Merge pull request #162 from mixcloud/mc-support-middlewares

add support for django 1.10 middlewares
  • Loading branch information...
2 parents d97cd26 + 9082477 commit b4ac4b4fddfef4c2ce29224fa6c839c09e143209 @matclayton matclayton committed on GitHub May 16, 2017
Showing with 8 additions and 1 deletion.
  1. +8 −1 experiments/middleware.py
@@ -1,7 +1,14 @@
from experiments.utils import participant
+try:
+ # for Django >= 1.10
+ from django.utils.deprecation import MiddlewareMixin
+except ImportError:
+ # for Django < 1.10
+ MiddlewareMixin = object
-class ExperimentsRetentionMiddleware(object):
+
+class ExperimentsRetentionMiddleware(MiddlewareMixin):
def process_response(self, request, response):
# Don't track, failed pages, ajax requests, logged out users or widget impressions.
# We detect widgets by relying on the fact that they are flagged as being embedable

0 comments on commit b4ac4b4

Please sign in to comment.