當前位置: 首頁>>代碼示例>>Python>>正文


Python Client.mc_issue_add方法代碼示例

本文整理匯總了Python中suds.client.Client.mc_issue_add方法的典型用法代碼示例。如果您正苦於以下問題:Python Client.mc_issue_add方法的具體用法?Python Client.mc_issue_add怎麽用?Python Client.mc_issue_add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在suds.client.Client的用法示例。


在下文中一共展示了Client.mc_issue_add方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: MantisSoap

# 需要導入模塊: from suds.client import Client [as 別名]
# 或者: from suds.client.Client import mc_issue_add [as 別名]

#.........這裏部分代碼省略.........
        boolean
            False if no id found
        """
        match = re.search('^\(tb\:(\d+)[,\)]', str)
        if match:
            return match.group(1)
        return False

    def getTaskNotesTeamboxIds(self, mantis_id):
        """ return all the teambox ids for the notes """

        data = self.getTask(mantis_id)

        l = []
        for i2, aComment in enumerate( data['notes'] ):
            teambox_id = self.extractTeamboxIdFromNote(aComment['text'])
            if teambox_id:
                l.append( int(teambox_id) )
        return l

    def getTaskNotes(self, mantis_id):
        data = self.getTask(mantis_id)

        l = []
        a = []

        if not 'notes' in data:
            return (l, a)

        for i2, aComment in enumerate( data['notes'] ):
            teambox_id = self.extractTeamboxIdFromNote(aComment['text'])
            if teambox_id:
                l.append( int(teambox_id) )
            else:
                a.append(aComment)
        return (l, a)

    def getTaskNoteByTbId(self, mantis_id, tb_id):
        return self._helper_find_by_id( mantis_id, False, tb_id)

    def getTaskNoteByNoteId(self, mantis_id, note_id):
        return self._helper_find_by_id( mantis_id, note_id, False)

    def _helper_find_by_id(self, mantis_id, note_id, tb_id):
        data = self.getTask(mantis_id)
        if not 'notes' in data:
            return False

        by_note_id = ( note_id != False )

        if not by_note_id:
            tb_id = str(tb_id)

        for i2, aComment in enumerate( data['notes'] ):
            if by_note_id:
                if str( aComment['id'] ) == note_id:
                    return aComment
            else:
                teambox_id = self.extractTeamboxIdFromNote(aComment['text'])
                if teambox_id and teambox_id == tb_id:
                    return aComment
        return False

    def getTask(self, mantis_id):
        if self.cached_mantis_obj and self.cached_mantis_obj['id'] == mantis_id:
            return self.cached_mantis_obj
        else:
            self.cached_mantis_obj = self.server.mc_issue_get( self.username, self.password, mantis_id )
        return self.cached_mantis_obj

    def addNoteToTask(self, task_id, note):
        data = { 'text': note }
        self.server.mc_issue_note_add( self.username, self.password, task_id, data )

    def createTask(self, task):
        newid = self.server.mc_issue_add(username=self.username, password=self.password, issue=task)
        print "Success: issue %s created" % newid
        return newid

    def updateTask(self, issue_id, task):
        self.server.mc_issue_update(username=self.username, password=self.password, issueId=issue_id, issue=task)
        self.cached_mantis_obj = False

    def extractUserInfoFromNote(self, note):
        rep = note['reporter']

        if 'real_name' in rep:
            return rep['real_name']
        return rep['name']

    def isSolved(self, issue_id):
        #80 = resolved
        task = self.getTask(issue_id)
        return task['status']['id'] == 80

    def setStatusToNew(self, issue_id):
        #10 = new
        task = self.getTask(issue_id)
        task['status']['id'] = 10
        self.updateTask(issue_id, task)
開發者ID:EdlinOrg,項目名稱:teambox-bugtracker-bridge,代碼行數:104,代碼來源:mantis_soap.py


注:本文中的suds.client.Client.mc_issue_add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。