X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/fc0b706f8c7eb67531df0a2acd972412e47c7010..d8c37344ee1994d4e9e567682cb798856cd38c77:/src/wolnelektury/abtests.py diff --git a/src/wolnelektury/abtests.py b/src/wolnelektury/abtests.py index 7fde579b0..6dd0ea2fc 100644 --- a/src/wolnelektury/abtests.py +++ b/src/wolnelektury/abtests.py @@ -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}