本文整理汇总了Python中bugzilla.Bugz.attach方法的典型用法代码示例。如果您正苦于以下问题:Python Bugz.attach方法的具体用法?Python Bugz.attach怎么用?Python Bugz.attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bugzilla.Bugz
的用法示例。
在下文中一共展示了Bugz.attach方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: attach
# 需要导入模块: from bugzilla import Bugz [as 别名]
# 或者: from bugzilla.Bugz import attach [as 别名]
def attach(self, bugid, filename, content_type = 'text/plain', description = None):
""" Attach a file to a bug given a filename. """
if not os.path.exists(filename):
raise BugzError('File not found: %s' % filename)
if not description:
description = block_edit('Enter description (optional)')
result = Bugz.attach(self, bugid, filename, description, filename,
content_type)
示例2: attach
# 需要导入模块: from bugzilla import Bugz [as 别名]
# 或者: from bugzilla.Bugz import attach [as 别名]
def attach(self, bugid, filename, content_type = 'text/plain', patch = False, description = None):
""" Attach a file to a bug given a filename. """
if not os.path.exists(filename):
raise BugzError('File not found: %s' % filename)
if not description:
description = block_edit('Enter description (optional)')
result = Bugz.attach(self, bugid, filename, description, filename,
content_type, patch)
if result == True:
self.log("'%s' has been attached to bug %s" % (filename, bugid))
else:
reason = ""
if result and result != False:
reason = "\nreason: %s" % result
raise RuntimeError("Failed to attach '%s' to bug %s%s" % (filename,
bugid, reason))