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


Python BuildService.isMaintainer方法代碼示例

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


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

示例1: ParticipantHandler

# 需要導入模塊: from buildservice import BuildService [as 別名]
# 或者: from buildservice.BuildService import isMaintainer [as 別名]
class ParticipantHandler(object):

    """ Participant class as defined by the SkyNET API """

    def __init__(self):
        self.obs = None
        self.oscrc = None

    def handle_wi_control(self, ctrl):
        """ job control thread """
        pass

    def handle_lifecycle_control(self, ctrl):
        """ participant control thread """
        if ctrl.message == "start":
            if ctrl.config.has_option("obs", "oscrc"):
                self.oscrc = ctrl.config.get("obs", "oscrc")

    def setup_obs(self, namespace):
        """ setup the Buildservice instance using the namespace as an alias
            to the apiurl """

        self.obs = BuildService(oscrc=self.oscrc, apiurl=namespace)


    def handle_wi(self, wid):
        """ actual job thread """

        wid.result = False
        if not wid.fields.msg:
            wid.fields.msg = []

        if not wid.fields.ev or not wid.fields.ev.actions:
            raise RuntimeError("Missing mandatory field 'ev.actions'")

        self.setup_obs(wid.fields.ev.namespace)

        for action in wid.fields.ev.actions:
            if not self.obs.isMaintainer(action["sourceproject"],
                                         wid.fields.ev.who):
                wid.fields.status = "FAILED"
                wid.fields.msg.append("%s who submitted request %s "\
                                      "from project %s is not allowed to do "\
                                      "so." % (wid.fields.ev.who,
                                               wid.fields.ev.rid,
                                               action["sourceproject"]))
                return

        wid.result = True
開發者ID:MeeGoIntegration,項目名稱:boss-standard-workflow,代碼行數:51,代碼來源:check_submitter_maintainer.py


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