def get_epic(self, issue): if issue.fields.issuetype.subtask: parent = Issue(issue._options, issue._session) parent.find(issue.fields.parent.key) issue = parent epic = Issue(issue._options, issue._session) epic.find(getattr(issue.fields, self.epic_link_field)) return epic
def __call__(self, timer, issue): project_id = self.get_issue_project_id(issue) # If the issue did not match any explicitly defined project and it is # a subtask, get the parent issue if not project_id and issue.fields.issuetype.subtask: parent = Issue(issue._options, issue._session) parent.find(issue.fields.parent.key) project_id = self.get_issue_project_id(parent) # If no project was found yet, get the default project if not project_id: project_id = self._project_ids.get(None) # At this point, if we didn't get a project, then it's an error if not project_id: raise ValueError('Could not find a project ID for issue type "{}"' .format(issue.fields.issuetype)) return project_id