本文整理汇总了Python中bkr.server.model.LabController.get_all方法的典型用法代码示例。如果您正苦于以下问题:Python LabController.get_all方法的具体用法?Python LabController.get_all怎么用?Python LabController.get_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bkr.server.model.LabController
的用法示例。
在下文中一共展示了LabController.get_all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index
# 需要导入模块: from bkr.server.model import LabController [as 别名]
# 或者: from bkr.server.model.LabController import get_all [as 别名]
def index(self, **kwargs):
kwargs.setdefault('tag', 'STABLE')
value = dict((k, v) for k, v in kwargs.iteritems()
if k in ['osmajor', 'tag', 'distro'])
options = {}
tags = DistroTag.used()
options['tag'] = [('', 'None selected')] + \
[(tag.tag, tag.tag) for tag in tags]
options['osmajor'] = [('', 'None selected')] + \
[(osmajor.osmajor, osmajor.osmajor) for osmajor
in OSMajor.ordered_by_osmajor(OSMajor.in_any_lab())]
options['distro'] = self._get_distro_options(**kwargs)
options['lab_controller_id'] = [(None, 'None selected')] + \
LabController.get_all(valid=True)
options['distro_tree_id'] = self._get_distro_tree_options(**kwargs)
attrs = {}
if not options['distro']:
attrs['distro'] = dict(disabled=True)
return dict(title=_(u'Reserve Workflow'),
widget=self.widget,
value=value,
widget_options=options,
widget_attrs=attrs)
示例2: index
# 需要导入模块: from bkr.server.model import LabController [as 别名]
# 或者: from bkr.server.model.LabController import get_all [as 别名]
def index(self, **kwargs):
value = dict((k, v) for k, v in kwargs.iteritems()
if k in ['osmajor', 'tag', 'distro'])
options = {}
tags = DistroTag.used()
# It's important that 'None selected' is prepended
# rather then appended to the list of tags, as that will ensure
# it is the default option in the drop down.
options['tag'] = [('', 'None selected')] + \
[(tag.tag, tag.tag) for tag in tags]
options['osmajor'] = [('', 'None selected')] + \
[(osmajor.osmajor, osmajor.osmajor) for osmajor
in OSMajor.ordered_by_osmajor(OSMajor.in_any_lab())]
options['distro'] = self._get_distro_options(**kwargs)
options['lab_controller_id'] = [(None, 'None selected')] + \
LabController.get_all(valid=True)
options['distro_tree_id'] = self._get_distro_tree_options(**kwargs)
attrs = {}
if not options['distro']:
attrs['distro'] = dict(disabled=True)
return dict(title=_(u'Reserve Workflow'),
widget=self.widget,
value=value,
widget_options=options,
widget_attrs=attrs)