X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6a943334c5e40a77a4ee782a471a74e006b032fb..8f031335a8a0dabceec381b89eb0cbbcb2f4b637:/src/experiments/base.py 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(