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


Python SOAPProxy.mc_issue_get方法代码示例

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


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

示例1: Mantis

# 需要导入模块: from SOAPpy import SOAPProxy [as 别名]
# 或者: from SOAPpy.SOAPProxy import mc_issue_get [as 别名]
class Mantis(callbacks.PluginRegexp):
    """Utilities related to mantis
    This plugin is able to display newly reported bug,
    and an expansion "bug #" to URI is provided.
    It can also detect "bug #" in chat.
    A template allow to change response message.
    """

    threaded = True
    unaddressedRegexps = ['snarfBug']

    def __init__(self, irc):
        self.__parent = super(Mantis, self)
        self.__parent.__init__(irc)

        self.saidBugs = ircutils.IrcDict()
        sayTimeout = self.registryValue('bugSnarferTimeout')
        for k in irc.state.channels.keys():
            self.saidBugs[k] = TimeoutQueue(sayTimeout)

        self.urlbase = self.registryValue('urlbase')
        self.privateurlbase = self.registryValue('privateurlbase')

        if self.privateurlbase != "":
            serviceUrl = self.privateurlbase + '/api/soap/mantisconnect.php'
        else:
            serviceUrl = self.urlbase + '/api/soap/mantisconnect.php'

        self.server = SOAPProxy(serviceUrl)._ns(namespace)
        self.username = self.registryValue('username')
        self.password = self.registryValue('password')
        self.oldperiodic = self.registryValue('bugPeriodicCheck')
        self.irc = irc
        self.lastBug = 0

        bugPeriodicCheck = self.oldperiodic
        if bugPeriodicCheck > 0:
            schedule.addPeriodicEvent(self._bugPeriodicCheck, bugPeriodicCheck, name=self.name())

        reload(sys)
        sys.setdefaultencoding('utf-8')


    def die(self):
        self.__parent.die()
        if self.oldperiodic > 0:
            schedule.removeEvent(self.name())


    def _bugPeriodicCheck(self):
        irc = self.irc
        newBug = self.server.mc_issue_get_biggest_id( username=self.username,
            password=self.password, project_id = 0 ) + 1
        #self.log.debug('Timer hit')
        if self.lastBug == 0:
            self.lastBug = newBug
        if newBug > self.lastBug:
            #self.log.debug('Bug is greater: '+ str(newBug) + ' ' + str(self.lastBug))
            strings = self.getBugs( range(self.lastBug, newBug) )
            for s in strings:
                sendtos = self.registryValue('bugPeriodicCheckTo')
                sendtos = sendtos.split()
                for sendto in sendtos:
                    #self.log.debug('sendtochannel: '+ sendto + s)
                    irc.queueMsg(ircmsgs.privmsg(sendto, s))
                    #self.log.debug('Sent: ' + s)
            self.lastBug = newBug
            #self.log.debug('End for: '+ str(newBug) + ' ' + str(self.lastBug))


    def bug(self, irc, msg, args, bugNumber):
        """<bug number>
        Expand bug # to a full URI
        """
        # supybot's 'int' type treats zero-prefixed bug numbers as octal,
        # so we need to take in strings and do a decimal conversion manually
        bugNumber = int(bugNumber)

        strings = self.getBugs( [ bugNumber ] )

        if strings == []:
            irc.reply( "sorry, bug %s was not found" % bugNumber )
        else:
            for s in strings:
                irc.reply(s, prefixNick=False)

    bug = wrap(bug, ['text'])


    def version( self, irc, msg, args ):
        """ Returns the Mantis SOAP API version running on server
        """
        irc.reply( "Mantis SOAP API version: " + self.server.mc_version() )
    version = wrap(version)


    def snarfBug(self, irc, msg, match):
#r"""\b((?P<install>\w+)\b\s*)?(?P<type>bug|attachment)\b[\s#]*(?P<id>\d+)"""
        r"""\bbug\b[\s#]*(?P<id>\d+)"""
        self.log.info('Snarf here')
#.........这里部分代码省略.........
开发者ID:dregad,项目名称:supybot-mantis,代码行数:103,代码来源:plugin.py


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