Beispiel #1
0
 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)
Beispiel #2
0
 def testParseDate_WithDifferentDefaultDate(self):
     parsed = date.parseDate("Yoyo-Yo", date.Date(2004, 2, 29))
     self.assertEqual(date.Date(2004, 2, 29), parsed)
Beispiel #3
0
 def testParseDate_WithNonsense(self):
     parsed = date.parseDate("Yoyo-Yo")
     self.assertEqual(date.Date(), parsed)
Beispiel #4
0
 def testParseDate_WithNone(self):
     parsed = date.parseDate("None")
     self.assertEqual(date.Date(), parsed)
Beispiel #5
0
 def testParseDate(self):
     parsed = date.parseDate("2004-1-1")
     self.assertEqual(date.Date(2004, 1, 1), parsed)
Beispiel #6
0
    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)
Beispiel #7
0
 def testParseDate_WithDifferentDefaultDate(self):
     parsed = date.parseDate("Yoyo-Yo", date.Today())
     self.assertEqual(date.Today(), parsed)
Beispiel #8
0
 def testParseDate_WithDifferentDefaultDate(self):
     parsed = date.parseDate("Yoyo-Yo", date.Date(2004, 2, 29))
     self.assertEqual(date.Date(2004, 2, 29), parsed)
Beispiel #9
0
 def testParseDate_WithNonsense(self):
     parsed = date.parseDate("Yoyo-Yo")
     self.assertEqual(date.Date(), parsed)
Beispiel #10
0
 def testParseDate_WithNone(self):
     parsed = date.parseDate("None")
     self.assertEqual(date.Date(), parsed)
Beispiel #11
0
 def testParseDate(self):
     parsed = date.parseDate("2004-1-1")
     self.assertEqual(date.Date(2004, 1, 1), parsed)
Beispiel #12
0
    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)
Beispiel #13
0
 def testParseDate_WithDifferentDefaultDate(self):
     parsed = date.parseDate("Yoyo-Yo", date.Today())
     self.assertEqual(date.Today(), parsed)