X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/fc0b706f8c7eb67531df0a2acd972412e47c7010..292be7b4adfea60105ba78d74ace7425eb7a4284:/src/wolnelektury/abtests.py?ds=sidebyside 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}