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