Skip to content

Commit 0c52707

Browse files
committed
use get() vs [] in remove_forced_decision
1 parent 68146a1 commit 0c52707

File tree

2 files changed

+172
-1
lines changed

2 files changed

+172
-1
lines changed

optimizely/optimizely_user_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def remove_forced_decision(self, OptimizelyDecisionContext):
207207
self.log.logger.error(OptimizelyDecisionMessage.SDK_NOT_READY)
208208
return False
209209

210-
if self.forced_decisions[OptimizelyDecisionContext]:
210+
if self.forced_decisions.get(OptimizelyDecisionContext):
211211
del self.forced_decisions[OptimizelyDecisionContext]
212212
return True
213213

similar_rule_keys_audience.json

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
{
2+
"version": "4",
3+
"rollouts": [
4+
{
5+
"experiments": [
6+
{
7+
"status": "Running",
8+
"audienceConditions": ["or", "20406066925"],
9+
"audienceIds": ["20406066925"],
10+
"variations": [
11+
{
12+
"variables": [],
13+
"id": "8048",
14+
"key": "variation2",
15+
"featureEnabled": true
16+
}
17+
],
18+
"forcedVariations": {},
19+
"key": "targeted_delivery",
20+
"layerId": "9300000007573",
21+
"trafficAllocation": [{ "entityId": "8048", "endOfRange": 10000 }],
22+
"id": "9300000007573"
23+
},
24+
{
25+
"status": "Running",
26+
"audienceConditions": [],
27+
"audienceIds": [],
28+
"variations": [
29+
{
30+
"variables": [],
31+
"id": "8046",
32+
"key": "off",
33+
"featureEnabled": false
34+
}
35+
],
36+
"forcedVariations": {},
37+
"key": "default-rollout-3046-20390585493",
38+
"layerId": "default-layer-rollout-3046-20390585493",
39+
"trafficAllocation": [{ "entityId": "8046", "endOfRange": 10000 }],
40+
"id": "default-rollout-3046-20390585493"
41+
}
42+
],
43+
"id": "rollout-3046-20390585493"
44+
},
45+
{
46+
"experiments": [
47+
{
48+
"status": "Running",
49+
"audienceConditions": ["or", "20415611520"],
50+
"audienceIds": ["20415611520"],
51+
"variations": [
52+
{
53+
"variables": [],
54+
"id": "8045",
55+
"key": "variation1",
56+
"featureEnabled": true
57+
}
58+
],
59+
"forcedVariations": {},
60+
"key": "targeted_delivery",
61+
"layerId": "9300000007569",
62+
"trafficAllocation": [{ "entityId": "8045", "endOfRange": 10000 }],
63+
"id": "9300000007569"
64+
},
65+
{
66+
"status": "Running",
67+
"audienceConditions": [],
68+
"audienceIds": [],
69+
"variations": [
70+
{
71+
"variables": [],
72+
"id": "8043",
73+
"key": "off",
74+
"featureEnabled": false
75+
}
76+
],
77+
"forcedVariations": {},
78+
"key": "default-rollout-3045-20390585493",
79+
"layerId": "default-layer-rollout-3045-20390585493",
80+
"trafficAllocation": [{ "entityId": "8043", "endOfRange": 10000 }],
81+
"id": "default-rollout-3045-20390585493"
82+
}
83+
],
84+
"id": "rollout-3045-20390585493"
85+
}
86+
],
87+
"typedAudiences": [
88+
{
89+
"id": "20415611520",
90+
"conditions": [
91+
"and",
92+
[
93+
"or",
94+
[
95+
"or",
96+
{
97+
"value": true,
98+
"type": "custom_attribute",
99+
"name": "hiddenLiveEnabled",
100+
"match": "exact"
101+
}
102+
]
103+
]
104+
],
105+
"name": "polina-test1"
106+
},
107+
{
108+
"id": "20406066925",
109+
"conditions": [
110+
"and",
111+
[
112+
"or",
113+
[
114+
"or",
115+
{
116+
"value": false,
117+
"type": "custom_attribute",
118+
"name": "hiddenLiveEnabled",
119+
"match": "exact"
120+
}
121+
]
122+
]
123+
],
124+
"name": "polina-test2"
125+
}
126+
],
127+
"anonymizeIP": true,
128+
"projectId": "20430981610",
129+
"variables": [],
130+
"featureFlags": [
131+
{
132+
"experimentIds": [],
133+
"rolloutId": "rollout-3046-20390585493",
134+
"variables": [],
135+
"id": "3046",
136+
"key": "flag2"
137+
},
138+
{
139+
"experimentIds": [],
140+
"rolloutId": "rollout-3045-20390585493",
141+
"variables": [],
142+
"id": "3045",
143+
"key": "flag1"
144+
}
145+
],
146+
"experiments": [],
147+
"audiences": [
148+
{
149+
"id": "20415611520",
150+
"conditions": "[\"or\", {\"match\": \"exact\", \"name\": \"$opt_dummy_attribute\", \"type\": \"custom_attribute\", \"value\": \"$opt_dummy_value\"}]",
151+
"name": "polina-test1"
152+
},
153+
{
154+
"id": "20406066925",
155+
"conditions": "[\"or\", {\"match\": \"exact\", \"name\": \"$opt_dummy_attribute\", \"type\": \"custom_attribute\", \"value\": \"$opt_dummy_value\"}]",
156+
"name": "polina-test2"
157+
},
158+
{
159+
"conditions": "[\"or\", {\"match\": \"exact\", \"name\": \"$opt_dummy_attribute\", \"type\": \"custom_attribute\", \"value\": \"$opt_dummy_value\"}]",
160+
"id": "$opt_dummy_audience",
161+
"name": "Optimizely-Generated Audience for Backwards Compatibility"
162+
}
163+
],
164+
"groups": [],
165+
"attributes": [{ "id": "20408641883", "key": "hiddenLiveEnabled" }],
166+
"botFiltering": false,
167+
"accountId": "17882702980",
168+
"events": [],
169+
"revision": "25",
170+
"sendFlagDecisions": true
171+
}

0 commit comments

Comments
 (0)