def __parseTaskNode(self, taskNode): kwargs = dict(subject=taskNode.getAttribute('subject'), description=self.__parseDescription(taskNode), id=taskNode.getAttribute('id'), startDate=date.parseDate(taskNode.getAttribute('startdate')), dueDate=date.parseDate(taskNode.getAttribute('duedate')), completionDate=date.parseDate(taskNode.getAttribute('completiondate')), recurrence=taskNode.getAttribute('recurrence'), recurrenceCount=self.__parseInteger(taskNode.getAttribute('recurrenceCount')), maxRecurrenceCount=self.__parseInteger(taskNode.getAttribute('maxRecurrenceCount')), budget=date.parseTimeDelta(taskNode.getAttribute('budget')), priority=self.__parseInteger(taskNode.getAttribute('priority')), hourlyFee=self.__parseFloat(taskNode.getAttribute('hourlyFee')), fixedFee=self.__parseFloat(taskNode.getAttribute('fixedFee')), reminder=self.__parseDateTime(taskNode.getAttribute('reminder')), attachments=self.__parseAttachmentNodes(taskNode.childNodes), shouldMarkCompletedWhenAllChildrenCompleted= \ self.__parseBoolean(taskNode.getAttribute('shouldMarkCompletedWhenAllChildrenCompleted')), children=self.__parseTaskNodes(taskNode.childNodes), efforts=self.__parseEffortNodes(taskNode.childNodes)) if self.__tskversion <= 13: kwargs['categories'] = self.__parseCategoryNodesWithinTaskNode(taskNode.childNodes) else: kwargs['categories'] = [] return task.Task(**kwargs)
def testParseDate_WithDifferentDefaultDate(self): parsed = date.parseDate("Yoyo-Yo", date.Date(2004, 2, 29)) self.assertEqual(date.Date(2004, 2, 29), parsed)
def testParseDate_WithNonsense(self): parsed = date.parseDate("Yoyo-Yo") self.assertEqual(date.Date(), parsed)
def testParseDate_WithNone(self): parsed = date.parseDate("None") self.assertEqual(date.Date(), parsed)
def testParseDate(self): parsed = date.parseDate("2004-1-1") self.assertEqual(date.Date(2004, 1, 1), parsed)
def feed(self, data): super(DateItem, self).feed(data) if self.state == 2: self.value = Date() if self.value is None else parseDate(self.value)
def testParseDate_WithDifferentDefaultDate(self): parsed = date.parseDate("Yoyo-Yo", date.Today()) self.assertEqual(date.Today(), parsed)
def feed(self, data): super(DateItem, self).feed(data) if self.state == 2: self.value = Date() if self.value is None else parseDate( self.value)