diff --git a/csfunctions/handler.py b/csfunctions/handler.py index 8ef8a10..9b8e770 100644 --- a/csfunctions/handler.py +++ b/csfunctions/handler.py @@ -68,8 +68,8 @@ 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): @@ -77,6 +77,8 @@ def link_objects(event: Event): # 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: