本文整理汇总了Python中bugzilla.Bugz.search方法的典型用法代码示例。如果您正苦于以下问题:Python Bugz.search方法的具体用法?Python Bugz.search怎么用?Python Bugz.search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bugzilla.Bugz
的用法示例。
在下文中一共展示了Bugz.search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: search
# 需要导入模块: from bugzilla import Bugz [as 别名]
# 或者: from bugzilla.Bugz import search [as 别名]
def search(self, *args, **kwds):
"""Performs a search on the bugzilla database with the keywords given on the title (or the body if specified).
"""
search_term = ' '.join(args).strip()
show_url = kwds['show_url']
del kwds['show_url']
search_opts = sorted([(opt, val) for opt, val in kwds.items()
if val != None and opt != 'order'])
if not (search_term or search_opts):
raise BugzError('Please give search terms or options.')
if search_term:
log_msg = 'Searching for \'%s\' ' % search_term
else:
log_msg = 'Searching for bugs '
if search_opts:
self.log(log_msg + 'with the following options:')
for opt, val in search_opts:
self.log(' %-20s = %s' % (opt, val))
else:
self.log(log_msg)
result = Bugz.search(self, search_term, **kwds)
if result == None:
raise RuntimeError('Failed to perform search')
if len(result) == 0:
self.log('No bugs found.')
return
self.listbugs(result, show_url)