本文整理汇总了Python中buildservice.BuildService.getUserEmail方法的典型用法代码示例。如果您正苦于以下问题:Python BuildService.getUserEmail方法的具体用法?Python BuildService.getUserEmail怎么用?Python BuildService.getUserEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildservice.BuildService
的用法示例。
在下文中一共展示了BuildService.getUserEmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ParticipantHandler
# 需要导入模块: from buildservice import BuildService [as 别名]
# 或者: from buildservice.BuildService import getUserEmail [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.mail_to:
wid.fields.mail_to = []
if not wid.fields.ev or not wid.fields.ev.who:
raise RuntimeError("Missing mandatory field 'ev.who'")
who = wid.fields.ev.who
self.setup_obs(wid.fields.ev.namespace)
user_email = self.obs.getUserEmail(who)
if user_email:
wid.fields.mail_to.append(user_email)
wid.result = True
else:
wid.fields.msg.append("User %s doesn't have an email" % who)