X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6a943334c5e40a77a4ee782a471a74e006b032fb..7bbeecb5dd5c5f20120f9e40e41568a3bff1caa4:/src/experiments/base.py?ds=inline diff --git a/src/experiments/base.py b/src/experiments/base.py index 726f451cd..92b1bc1bd 100644 --- a/src/experiments/base.py +++ b/src/experiments/base.py @@ -7,6 +7,7 @@ class Experiment: name = 'experiment' explicit = False size = 0 + switchable = True def qualify(self, request): return True @@ -27,12 +28,13 @@ class Experiment: if self.qualify(request) is False: return None, False - cookie_value = request.COOKIES.get(f'EXPERIMENT_{slug}') - if cookie_value is not None: - if cookie_value == 'on': - return True, True - elif cookie_value == 'off': - return False, True + if self.switchable or request.user.is_staff: + cookie_value = request.COOKIES.get(f'EXPERIMENT_{slug}') + if cookie_value is not None: + if cookie_value == 'on': + return True, True + elif cookie_value == 'off': + return False, True number = int( hashlib.md5(