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