def taskNode(self, parentNode, task): # pylint: disable=W0621 maxDateTime = self.maxDateTime node = self.baseCompositeNode(parentNode, task, 'task', self.taskNode) node.attrib['status'] = str(task.getStatus()) if task.plannedStartDateTime() != maxDateTime: node.attrib['plannedstartdate'] = str(task.plannedStartDateTime()) if task.dueDateTime() != maxDateTime: node.attrib['duedate'] = str(task.dueDateTime()) if task.actualStartDateTime() != maxDateTime: node.attrib['actualstartdate'] = str(task.actualStartDateTime()) if task.completionDateTime() != maxDateTime: node.attrib['completiondate'] = str(task.completionDateTime()) if task.percentageComplete(): node.attrib['percentageComplete'] = str(task.percentageComplete()) if task.recurrence(): self.recurrenceNode(node, task.recurrence()) if task.budget() != date.TimeDelta(): node.attrib['budget'] = self.budgetAsAttribute(task.budget()) if task.priority(): node.attrib['priority'] = str(task.priority()) if task.hourlyFee(): node.attrib['hourlyFee'] = str(task.hourlyFee()) if task.fixedFee(): node.attrib['fixedFee'] = str(task.fixedFee()) reminder = task.reminder() if reminder != maxDateTime and reminder != None: node.attrib['reminder'] = str(reminder) reminderBeforeSnooze = task.reminder(includeSnooze=False) if reminderBeforeSnooze != None and reminderBeforeSnooze < task.reminder(): node.attrib['reminderBeforeSnooze'] = str(reminderBeforeSnooze) prerequisiteIds = ' '.join([prerequisite.id() for prerequisite in \ sortedById(task.prerequisites())]) if prerequisiteIds: node.attrib['prerequisites'] = prerequisiteIds if task.shouldMarkCompletedWhenAllChildrenCompleted() != None: node.attrib['shouldMarkCompletedWhenAllChildrenCompleted'] = \ str(task.shouldMarkCompletedWhenAllChildrenCompleted()) for effort in sortedById(task.efforts()): self.effortNode(node, effort) for eachNote in sortedById(task.notes()): self.noteNode(node, eachNote) for attachment in sortedById(task.attachments()): self.attachmentNode(node, attachment) return node
def taskNode(self, task): # pylint: disable-msg=W0621 maxDateTime = self.maxDateTime node = self.baseCompositeNode(task, 'task', self.taskNode) node.setAttribute('status', str(task.getStatus())) if task.startDateTime() != maxDateTime: node.setAttribute('startdate', str(task.startDateTime())) if task.dueDateTime() != maxDateTime: node.setAttribute('duedate', str(task.dueDateTime())) if task.completionDateTime() != maxDateTime: node.setAttribute('completiondate', str(task.completionDateTime())) if task.percentageComplete() != 0: node.setAttribute('percentageComplete', str(task.percentageComplete())) if task.recurrence(): node.appendChild(self.recurrenceNode(task.recurrence())) if task.budget() != date.TimeDelta(): node.setAttribute('budget', self.budgetAsAttribute(task.budget())) if task.priority() != 0: node.setAttribute('priority', str(task.priority())) if task.hourlyFee() != 0: node.setAttribute('hourlyFee', str(task.hourlyFee())) if task.fixedFee() != 0: node.setAttribute('fixedFee', str(task.fixedFee())) if task.reminder() != None: node.setAttribute('reminder', str(task.reminder())) prerequisiteIds = ' '.join([prerequisite.id() for prerequisite in \ task.prerequisites()]) if prerequisiteIds: node.setAttribute('prerequisites', prerequisiteIds) if task.shouldMarkCompletedWhenAllChildrenCompleted() != None: node.setAttribute('shouldMarkCompletedWhenAllChildrenCompleted', str(task.shouldMarkCompletedWhenAllChildrenCompleted())) for effort in task.efforts(): node.appendChild(self.effortNode(effort)) for eachNote in task.notes(): node.appendChild(self.noteNode(eachNote)) for attachment in task.attachments(): node.appendChild(self.attachmentNode(attachment)) return node
def taskNode(self, task): # pylint: disable-msg=W0621 node = self.baseCompositeNode(task, "task", self.taskNode) node.setAttribute("status", str(task.getStatus())) if task.startDateTime() != date.DateTime(): node.setAttribute("startdate", str(task.startDateTime())) if task.dueDateTime() != date.DateTime(): node.setAttribute("duedate", str(task.dueDateTime())) if task.completionDateTime() != date.DateTime(): node.setAttribute("completiondate", str(task.completionDateTime())) if task.percentageComplete() != 0: node.setAttribute("percentageComplete", str(task.percentageComplete())) if task.recurrence(): node.appendChild(self.recurrenceNode(task.recurrence())) if task.budget() != date.TimeDelta(): node.setAttribute("budget", self.budgetAsAttribute(task.budget())) if task.priority() != 0: node.setAttribute("priority", str(task.priority())) if task.hourlyFee() != 0: node.setAttribute("hourlyFee", str(task.hourlyFee())) if task.fixedFee() != 0: node.setAttribute("fixedFee", str(task.fixedFee())) if task.reminder() != None: node.setAttribute("reminder", str(task.reminder())) prerequisiteIds = " ".join([prerequisite.id() for prerequisite in task.prerequisites()]) if prerequisiteIds: node.setAttribute("prerequisites", prerequisiteIds) if task.shouldMarkCompletedWhenAllChildrenCompleted() != None: node.setAttribute( "shouldMarkCompletedWhenAllChildrenCompleted", str(task.shouldMarkCompletedWhenAllChildrenCompleted()) ) for effort in task.efforts(): node.appendChild(self.effortNode(effort)) for eachNote in task.notes(): node.appendChild(self.noteNode(eachNote)) for attachment in task.attachments(): node.appendChild(self.attachmentNode(attachment)) return node