当前位置: 首页>>代码示例>>Python>>正文


Python Client.mc_issue_get方法代码示例

本文整理汇总了Python中suds.client.Client.mc_issue_get方法的典型用法代码示例。如果您正苦于以下问题:Python Client.mc_issue_get方法的具体用法?Python Client.mc_issue_get怎么用?Python Client.mc_issue_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在suds.client.Client的用法示例。


在下文中一共展示了Client.mc_issue_get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MantisSoap

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import mc_issue_get [as 别名]
class MantisSoap():

    def __init__(self):
        self.url = config.MANTIS_SOAPURL
        self.wdsl = config.MANTIS_SOAP_WDSL

        self.username = config.MANTIS_USERNAME
        self.password = config.MANTIS_PASSWORD

        self.server = Client(url=self.wdsl, location=self.url).service

        self.cached_mantis_obj = False

    def extractTeamboxIdFromNote(self, str):
        """ Extract the teambox id from the string
            Looks for (tb:NNN+, at the beginning of the string

        Parameters
        ----------
        str : string

        Returns
        -------
        string
            The id as a string
        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):
#.........这里部分代码省略.........
开发者ID:EdlinOrg,项目名称:teambox-bugtracker-bridge,代码行数:103,代码来源:mantis_soap.py


注:本文中的suds.client.Client.mc_issue_get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。