Workaround for API problem, minor fixes.
[wolnelektury.git] / src / wolnelektury / abtests.py
index 7fde579..6dd0ea2 100644 (file)
@@ -4,10 +4,12 @@ from django.conf import settings
 
 def context_processor(request):
     ab = {}
+    overrides = getattr(settings, 'AB_TESTS_OVERRIDES', {})
     for abtest, nvalues in settings.AB_TESTS.items():
-        print(abtest, nvalues)
-        ab[abtest] = hashlib.md5(
+        ab[abtest] = overrides.get(
+            abtest,
+            hashlib.md5(
                 (abtest + request.META['REMOTE_ADDR']).encode('utf-8')
             ).digest()[0] % nvalues
-    print(ab)
+        )
     return {'AB': ab}