本文整理汇总了Python中daklib.config.Config.find_b方法的典型用法代码示例。如果您正苦于以下问题:Python Config.find_b方法的具体用法?Python Config.find_b怎么用?Python Config.find_b使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类daklib.config.Config
的用法示例。
在下文中一共展示了Config.find_b方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: announce_accept
# 需要导入模块: from daklib.config import Config [as 别名]
# 或者: from daklib.config.Config import find_b [as 别名]
def announce_accept(upload):
""" Announce an upload.
@type upload: L{daklib.upload.Source} or L{daklib.upload.Binary}
@param upload: upload to handle
"""
cnf = Config()
subst = _subst_for_upload(upload)
whitelists = _whitelists(upload)
accepted_to_real_suite = any(suite.policy_queue is None or suite in upload.from_policy_suites for suite in upload.suites)
suite_names = []
for suite in upload.suites:
if suite.policy_queue:
suite_names.append("{0}->{1}".format(suite.suite_name, suite.policy_queue.queue_name))
else:
suite_names.append(suite.suite_name)
suite_names.extend(suite.suite_name for suite in upload.from_policy_suites)
subst['__SUITE__'] = ', '.join(suite_names) or '(none)'
message = TemplateSubst(subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.accepted'))
send_mail(message, whitelists=whitelists)
if accepted_to_real_suite and upload.sourceful:
# send mail to announce lists and tracking server
announce = set()
for suite in upload.suites:
if suite.policy_queue is None or suite in upload.from_policy_suites:
announce.update(suite.announce or [])
announce_list_address = ", ".join(announce)
# according to #890944 this email shall be sent to [email protected]<TrackingServer> to avoid
# bouncing emails
# the package email alias is not yet created shortly after accepting the package
tracker = cnf.get('Dinstall::TrackingServer')
if tracker:
announce_list_address = "{0}\nBcc: [email protected]{1}".format(announce_list_address, tracker)
if len(announce_list_address) != 0:
my_subst = subst.copy()
my_subst['__ANNOUNCE_LIST_ADDRESS__'] = announce_list_address
message = TemplateSubst(my_subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.announce'))
send_mail(message, whitelists=whitelists)
close_bugs_default = cnf.find_b('Dinstall::CloseBugs')
close_bugs = any(s.close_bugs if s.close_bugs is not None else close_bugs_default for s in upload.suites)
if accepted_to_real_suite and upload.sourceful and close_bugs:
for bug in upload.bugs:
my_subst = subst.copy()
my_subst['__BUG_NUMBER__'] = str(bug)
message = TemplateSubst(my_subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.bug-close'))
send_mail(message, whitelists=whitelists)
示例2: announce_accept
# 需要导入模块: from daklib.config import Config [as 别名]
# 或者: from daklib.config.Config import find_b [as 别名]
def announce_accept(upload):
cnf = Config()
subst = _subst_for_upload(upload)
whitelists = _whitelists(upload)
accepted_to_real_suite = any(suite.policy_queue is None or suite in upload.from_policy_suites for suite in upload.suites)
suite_names = []
for suite in upload.suites:
if suite.policy_queue:
suite_names.append("{0}->{1}".format(suite.suite_name, suite.policy_queue.queue_name))
else:
suite_names.append(suite.suite_name)
suite_names.extend(suite.suite_name for suite in upload.from_policy_suites)
subst['__SUITE__'] = ', '.join(suite_names) or '(none)'
message = TemplateSubst(subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.accepted'))
send_mail(message, whitelists=whitelists)
if accepted_to_real_suite and upload.sourceful:
# senf mail to announce lists and tracking server
announce = set()
for suite in upload.suites:
if suite.policy_queue is None or suite in upload.from_policy_suites:
announce.update(suite.announce or [])
announce_list_address = ", ".join(announce)
tracking = cnf.get('Dinstall::TrackingServer')
if tracking:
announce_list_address = "{0}\nBcc: {1}@{2}".format(announce_list_address, upload.source, tracking)
if len(announce_list_address) != 0:
my_subst = subst.copy()
my_subst['__ANNOUNCE_LIST_ADDRESS__'] = announce_list_address
message = TemplateSubst(my_subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.announce'))
send_mail(message, whitelists=whitelists)
close_bugs_default = cnf.find_b('Dinstall::CloseBugs')
close_bugs = any(s.close_bugs if s.close_bugs is not None else close_bugs_default for s in upload.suites)
if accepted_to_real_suite and upload.sourceful and close_bugs:
for bug in upload.bugs:
my_subst = subst.copy()
my_subst['__BUG_NUMBER__'] = str(bug)
message = TemplateSubst(my_subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.bug-close'))
send_mail(message, whitelists=whitelists)