2 from django.conf import settings
11 def qualify(self, request):
14 def __init__(self, request):
15 self.value = self.get_value(request)
17 def override(self, value):
20 def get_value(self, request):
21 overrides = getattr(settings, 'EXPERIMENTS_OVERRIDES', {})
24 return overrides[slug]
26 if self.qualify(request) is False:
29 cookie_value = request.COOKIES.get(f'EXPERIMENT_{slug}')
30 if cookie_value is not None:
31 if cookie_value == 'on':
33 elif cookie_value == 'off':
38 (slug + request.META['REMOTE_ADDR']).encode('utf-8')
42 return number < self.size