X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6a943334c5e40a77a4ee782a471a74e006b032fb..5abc88f0d2ad3036dd526fbff5f0241f1d6480e1:/src/experiments/base.py?ds=sidebyside 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(