fnp
/
wolnelektury.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
General A/B testing.
[wolnelektury.git]
/
src
/
wolnelektury
/
abtests.py
1
import hashlib
2
from django.conf import settings
3
4
5
def context_processor(request):
6
ab = {}
7
for abtest, nvalues in settings.AB_TESTS.items():
8
print(abtest, nvalues)
9
ab[abtest] = hashlib.md5(
10
(abtest + request.META['REMOTE_ADDR']).encode('utf-8')
11
).digest()[0] % nvalues
12
print(ab)
13
return {'AB': ab}