def get_full_tree_title(self): """Returns the full title of the task tree It is constituted by the list of the names of the tasks and parent task separated by slashes e.g. for Bar task in Foo task : u" Foo/Bare """ obj = self.context full_tree_title = obj.Title() while ITask.providedBy(obj.aq_parent): full_tree_title = obj.aq_parent.Title() + ' / ' + full_tree_title obj = obj.aq_parent return full_tree_title
def get_last_subtasks(self): """ Return each last unique sub task of this macro task. """ subtask_type = set() sub_tasks = [] for obj in reversed(self.objectValues()): if ITask.providedBy(obj): subtask = obj if subtask.task_config_UID not in subtask_type: subtask_type.add(subtask.task_config_UID) sub_tasks.append(subtask) return reversed(sub_tasks)
def get_highest_task_parent(self, task=False): """ Get the object containing the highest ITask object or the highest ITask object if task is True """ obj = self.context while obj is not None: # if not hasattr(obj, "aq_parent"): # raise RuntimeError("Parent traversing interrupted by object: " + str(obj)) parent = obj.aq_parent if not ITask.providedBy(parent): if task: # we want the highest task, we return the current task obj return obj else: # we return the parent that's not a task return parent obj = parent return obj
def get_subtasks(self): """ Return all sub tasks of this macro task. """ sub_tasks = [obj for obj in self.objectValues() if ITask.providedBy(obj)] return sub_tasks