Exemplo n.º 1
0
 def __parseTaskNode(self, taskNode):
     subject = taskNode.getAttribute('subject')
     id = taskNode.getAttribute('id')
     description = self.__parseDescription(taskNode)
     startDate = date.parseDate(taskNode.getAttribute('startdate'))
     dueDate = date.parseDate(taskNode.getAttribute('duedate'))
     completionDate = date.parseDate(taskNode.getAttribute('completiondate'))
     budget = date.parseTimeDelta(taskNode.getAttribute('budget'))
     priority = self.__parseInteger(taskNode.getAttribute('priority'))
     lastModificationTime = \
         self.__parseDateTime(taskNode.getAttribute('lastModificationTime'))
     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'))
     if self.__tskversion <= 13:
         categories = self.__parseCategoryNodesWithinTaskNode(taskNode.childNodes)
     else:
         categories = []
     children = self.__parseTaskNodes(taskNode.childNodes)
     efforts = self.__parseEffortNodes(taskNode.childNodes)
     parent = task.Task(subject, description, id_=id, startDate=startDate, 
         dueDate=dueDate, completionDate=completionDate, budget=budget, 
         priority=priority, lastModificationTime=lastModificationTime, 
         hourlyFee=hourlyFee, fixedFee=fixedFee, reminder=reminder, 
         categories=categories, attachments=attachments, children=children,
         efforts=efforts,
         shouldMarkCompletedWhenAllChildrenCompleted=\
             shouldMarkCompletedWhenAllChildrenCompleted)
     return parent        
Exemplo n.º 2
0
 def testParseDate_WithDifferentDefaultDate(self):
     parsed = date.parseDate("Yoyo-Yo", date.Today())
     self.assertEqual(date.Today(), parsed)
Exemplo n.º 3
0
 def testParseDate_WithNone(self):
     parsed = date.parseDate("None")
     self.assertEqual(date.Date(), parsed)
Exemplo n.º 4
0
 def testParseDate_WithNonsense(self):
     parsed = date.parseDate("Yoyo-Yo")
     self.assertEqual(date.Date(), parsed)
Exemplo n.º 5
0
 def testParseDate(self):
     parsed = date.parseDate("2004-1-1")
     self.assertEqual(date.Date(2004, 1, 1), parsed)