コード例 #1
0
 def mostRecent(self,args):
     if isinstance(args, basestring):
         return dateparser.parse(args)
     else:
         dates = []
         for d in args:
             dates.append(dateparser.parse(d))
         return max(dates)
コード例 #2
0
    def convertDates(self,bug):
        for node in bug:
            if node.tag == 'date':
                date = node
            elif node.tag == 'date_submitted':
                dateSub = node

        date_obj = dateparser.parse(date.text)
        dateSub_obj = dateparser.parse(dateSub.text)

        epoch = dt.datetime.utcfromtimestamp(0)
        #round datetime and convert it to proper format for mantis xml, which is Epoch time
        date.text = str(int((date_obj - epoch).total_seconds()))
        dateSub.text = str(int((dateSub_obj - epoch).total_seconds()))
コード例 #3
0
    def removeIssuesBefore(self,date,root):
        if date == "":
            return
        deletion = []
        for node in root:
            issue_date = node.findtext("date")
            if dateparser.parse(issue_date) < date:
                deletion.append(node)

        for d in deletion:
            root.remove(d)