From f15994bbbd4b15d2bff354657cbd326b2a512c93 Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Mon, 28 Oct 2024 15:07:46 -0400 Subject: Properly wrap the Activity object returned from 'register_activity'. --- python/workflow.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/workflow.py b/python/workflow.py index 7989d6bd..8213a6b6 100644 --- a/python/workflow.py +++ b/python/workflow.py @@ -342,7 +342,7 @@ class Workflow(metaclass=_WorkflowMetaclass): :param Activity activity: the Activity to register :param list[str] subactivities: the list of Activities to assign - :return: True on Success, False otherwise + :return: the registered Activity :rtype: Activity """ if activity is None: @@ -350,7 +350,10 @@ class Workflow(metaclass=_WorkflowMetaclass): input_list = (ctypes.c_char_p * len(subactivities))() for i in range(0, len(subactivities)): input_list[i] = str(subactivities[i]).encode('charmap') - return core.BNWorkflowRegisterActivity(self.handle, activity.handle, input_list, len(subactivities)) + handle = core.BNWorkflowRegisterActivity(self.handle, activity.handle, input_list, len(subactivities)) + if handle is None: + return None + return activity def contains(self, activity: ActivityType) -> bool: """ -- cgit v1.3.1