Skip to content

Commit 7e710bf

Browse files
committed
Fix serializer logic to handle null config
1 parent ad01ca3 commit 7e710bf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

llmstack/data/serializers.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,21 @@ def get_type(self, obj):
2626
"name": "Custom",
2727
}
2828

29+
def _get_config(self, obj):
30+
return obj.config or {}
31+
2932
def get_pipeline(self, obj):
30-
return obj.config.get("pipeline", None)
33+
return self._get_config().get("pipeline", None)
3134

3235
def get_refresh_interval(self, obj):
33-
return obj.config.get("refresh_interval", None)
36+
return self._get_config().get("refresh_interval", None)
3437

3538
def get_has_source(self, obj):
36-
return obj.config.get("pipeline", {}).get("source", {}).get("slug", None) is not None
39+
return self._get_config().get("pipeline", {}).get("source", {}).get("slug", None) is not None
3740

3841
def get_is_destination_only(self, obj):
3942
return (
40-
obj.config.get("pipeline", {}).get("destination", {}).get("slug", None) is not None
43+
self._get_config().get("pipeline", {}).get("destination", {}).get("slug", None) is not None
4144
and self.get_has_source(obj) is False
4245
)
4346

0 commit comments

Comments
 (0)