Exemple #1
0
    def __init__(self, xml):
        self.client = ""
        self.code = ""
        self.id = 0
        self.tasks = []
        
        if not xml:
            return
        try:
            self.name = Harvest.getSingleXMLValue(xml, 'name')
            
            if not self.name:
                self.name = Harvest.getNodeText(xml.childNodes)
                return
            
            self.code = Harvest.getSingleXMLValue(xml, 'code')
            self.id = Harvest.getSingleXMLValue(xml, 'id')
            self.client = Harvest.getSingleXMLValue(xml, 'client')

            tasks = xml.getElementsByTagName('task')
            
            if tasks:
                for i in tasks:
                    tsk = Task(i)
                    self.tasks.append(tsk)
                    
        except Exception as e:
            print e
            return
Exemple #2
0
 def __init__(self, xml):
     if not xml:
         return
     
     try:
         self.name = Harvest.getSingleXMLValue(xml, 'name')
         self.id = Harvest.getSingleXMLValue(xml, 'id')
         billable = Harvest.getSingleXMLValue(xml, 'client')
         
         if billable == 'true':
             self.billable = True
     except Exception as e:
         return
Exemple #3
0
 def __init__(self, xml = None):
     if not xml:
         return
     try:
         self.id = Harvest.getSingleXMLValue(xml, 'id')
         self.client = Harvest.getSingleXMLValue(xml, 'client')
         self.project = Harvest.getSingleXMLValue(xml, 'project')
         self.task = Harvest.getSingleXMLValue(xml, 'task')
         self.hours = Harvest.getSingleXMLValue(xml, 'hours')
         self.notes = Harvest.getSingleXMLValue(xml, 'notes')
         self.timer_started_at = Harvest.getSingleXMLValue(xml, 'timer_started_at')
     except Exception as e:
         return