本文整理汇总了Python中bugzilla.Bugz.get方法的典型用法代码示例。如果您正苦于以下问题:Python Bugz.get方法的具体用法?Python Bugz.get怎么用?Python Bugz.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bugzilla.Bugz
的用法示例。
在下文中一共展示了Bugz.get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from bugzilla import Bugz [as 别名]
# 或者: from bugzilla.Bugz import get [as 别名]
def get(self, bugid, comments = True, attachments = True):
""" Fetch bug details given the bug id """
self.log('Getting bug %s ..' % bugid)
result = Bugz.get(self, bugid)
if result is None:
raise RuntimeError('Bug %s not found' % bugid)
# Print out all the fields below by extract the text
# directly from the tag, and just ignore if we don't
# see the tag.
FIELDS = (
('short_desc', 'Title'),
('assigned_to', 'Assignee'),
('creation_ts', 'Reported'),
('delta_ts', 'Updated'),
('bug_status', 'Status'),
('resolution', 'Resolution'),
('bug_file_loc', 'URL'),
('bug_severity', 'Severity'),
('priority', 'Priority'),
('reporter', 'Reporter'),
)
MORE_FIELDS = (
('product', 'Product'),
('component', 'Component'),
('status_whiteboard', 'Whiteboard'),
('keywords', 'Keywords'),
)
for field, name in FIELDS + MORE_FIELDS:
try:
value = result.find('.//%s' % field).text
if value is None:
continue
except AttributeError:
continue
print '%-12s: %s' % (name, value.encode(self.enc))
# Print out the cc'ed people
cced = result.findall('.//cc')
for cc in cced:
print '%-12s: %s' % ('CC', cc.text)
# print out depends
dependson = ', '.join([d.text for d in result.findall('.//dependson')])
blocked = ', '.join([d.text for d in result.findall('.//blocked')])
if dependson:
print '%-12s: %s' % ('DependsOn', dependson)
if blocked:
print '%-12s: %s' % ('Blocked', blocked)
bug_comments = result.findall('.//long_desc')
bug_attachments = result.findall('.//attachment')
print '%-12s: %d' % ('Comments', len(bug_comments))
print '%-12s: %d' % ('Attachments', len(bug_attachments))
print
if attachments:
for attachment in bug_attachments:
aid = attachment.find('.//attachid').text
desc = attachment.find('.//desc').text
when = attachment.find('.//date').text
print '[Attachment] [%s] [%s]' % (aid, desc.encode(self.enc))
if comments:
i = 0
wrapper = textwrap.TextWrapper(width = self.columns)
for comment in bug_comments:
try:
who = comment.find('.//who').text.encode(self.enc)
except AttributeError:
# Novell doesn't use 'who' on xml
who = ""
when = comment.find('.//bug_when').text.encode(self.enc)
what = comment.find('.//thetext').text
print '\n[Comment #%d] %s : %s' % (i, who, when)
print '-' * (self.columns - 1)
if what is None:
what = ''
# print wrapped version
for line in what.split('\n'):
if len(line) < self.columns:
print line.encode(self.enc)
else:
for shortline in wrapper.wrap(line):
print shortline.encode(self.enc)
i += 1
print