It's highly possible that I'm just using gargoyle wrong, but I'm experiencing surprising behavior.
In one of my project's apps, I've created a gargoyle.py file:
from __future__ import absolute_import
from gargoyle import gargoyle
gargoyle['foo'].add_condition(
condition_set='gargoyle.builtins.UserConditionSet(auth.user)',
field_name='percent',
condition='0-50'
)
My understanding is that this will make the foo switch active for 50% of users. This seems to work. The value in the database after I run my local server is:
if condition not in self.value[namespace][field_name]:
self.value[namespace][field_name].append((exclude and EXCLUDE or INCLUDE, condition))
Here it's checking if condition which is '0-50' is "in" a list of tuples, which will always return false. Obviously this is solvable by adding commit=False to Switch.add_condition. However, it makes me worry that I'm missing something fundamental.
It's highly possible that I'm just using gargoyle wrong, but I'm experiencing surprising behavior.
In one of my project's apps, I've created a
gargoyle.py
file:My understanding is that this will make the
foo
switch active for 50% of users. This seems to work. The value in the database after I run my local server is:But now, if I restart my server, the condition is duplicated:
I've traced this to
Switch.add_condition
:Here it's checking if
condition
which is'0-50'
is "in" a list of tuples, which will always return false. Obviously this is solvable by addingcommit=False
toSwitch.add_condition
. However, it makes me worry that I'm missing something fundamental.