Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions csfunctions/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ def link_objects(event: Event):
# e.g. all parts would be in Event.data.parts = list[Part]

for field_name in data.model_fields_set:
# go through each field in data and look for fields that are lists
# objects will always be passed in a list
# go through each field in data and look for fields that are lists of BaseObjects
# or direct BaseObjects

field = getattr(data, field_name)
if isinstance(field, list):
for obj in field:
# the list might contain entries that are not objects, so we check first
if isinstance(obj, BaseObject):
obj.link_objects(data)
elif isinstance(field, BaseObject):
field.link_objects(data)


def execute(function_name: str, request_body: str, function_dir: str = "src") -> str:
Expand Down
Loading