Skip to content

Commit

Permalink
more undoing
Browse files Browse the repository at this point in the history
  • Loading branch information
seankane-msft committed Apr 8, 2021
1 parent 565a2ea commit 14daae9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,19 @@ def filters(self, new_filters):
def _from_generated(cls, key_value):
# type: (KeyValue) -> FeatureFlagConfigurationSetting
try:
filters = None
enabled = None
if key_value is None:
return None
if key_value.value:
try:
key_value.value = json.loads(key_value.value)
filters = key_value.value["conditions"]["client_filters"]
enabled = key_value.value["enabled"]
except json.decoder.JSONDecodeError:
pass

filters = key_value.value["conditions"]["client_filters"]

return cls(
feature_id=key_value.key,
enabled=enabled,
enabled=key_value.value["enabled"],
label=key_value.label,
content_type=key_value.content_type,
last_modified=key_value.last_modified,
Expand All @@ -239,6 +237,13 @@ def _from_generated(cls, key_value):

def _to_generated(self):
# type: (...) -> KeyValue
# value = {
# u"id": self.key,
# u"description": self.description,
# u"enabled": self._enabled,
# u"conditions": {u"client_filters": self._filters},
# }
# value = json.dumps(value)

return KeyValue(
key=self.key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
LABEL = "test_label1_" + LABEL_UUID
LABEL_RESERVED_CHARS = "test_label2_*, \\" + LABEL_UUID # contains reserved chars *,\
TEST_CONTENT_TYPE = "test content type"
TEST_VALUE = "test value"
TEST_VALUE = "test value"

0 comments on commit 14daae9

Please sign in to comment.