本文整理汇总了Python中bkr.server.model.System.all方法的典型用法代码示例。如果您正苦于以下问题:Python System.all方法的具体用法?Python System.all怎么用?Python System.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bkr.server.model.System
的用法示例。
在下文中一共展示了System.all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: systems
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import all [as 别名]
def systems(self,group_id=None,*args,**kw):
try:
group = Group.by_id(group_id)
except NoResultFound:
log.exception('Group id %s is not a valid group id' % group_id)
flash(_(u'Need a valid group to search on'))
redirect('../groups/mine')
systems = System.all(identity.current.user).filter(System.groups.contains(group))
title = 'Systems in Group %s' % group.group_name
from bkr.server.controllers import Root
return Root()._systems(systems,title, group_id = group_id,**kw)
示例2: reserve
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import all [as 别名]
def reserve(self, action='.', *args, **kw):
searchvalue = None
reserves = System.all(identity.current.user).join('open_reservation')\
.options(contains_eager(System.open_reservation))
reserves_return = self._reserves(reserves, **kw)
search_options = {}
if reserves_return:
if 'reserves_found' in reserves_return:
reserves = reserves_return['reserves_found']
if 'searchvalue' in reserves_return:
searchvalue = reserves_return['searchvalue']
if 'simplesearch' in reserves_return:
search_options['simplesearch'] = reserves_return['simplesearch']
search_bar = SearchBar(name='reservesearch',
label=_(u'Reserve Search'),
table = search_utility.SystemReserve.search.create_search_table(),
complete_data=search_utility.SystemReserve.search.create_complete_search_table(),
search_controller=url("./get_search_options_reserve"),
)
reservations = [system.open_reservation for system in reserves]
reserve_grid = myPaginateDataGrid(fields=[
widgets.PaginateDataGrid.Column(name='system.fqdn', getter=lambda x: make_link(url = '/view/%s' % x.system.fqdn, text = x.system), title=u'System', options=dict(sortable=True)),
widgets.PaginateDataGrid.Column(name='start_time',
getter=lambda x: x.start_time,
title=u'Reserved Since',
options=dict(sortable=True, datetime=True)),
widgets.PaginateDataGrid.Column(name='user', getter=lambda x: x.user, title=u'Current User', options=dict(sortable=True)),
])
return dict(title=u"Reserve Report",
grid = reserve_grid,
search_bar = search_bar,
options = search_options,
action=action,
searchvalue = searchvalue,
object_count=len(reservations),
list=reservations)
示例3: query
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import all [as 别名]
def query(cls):
for system in System.all(identity.current.user):
for pool in system.pools:
yield CSV_SystemPool(system, pool)
示例4: query
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import all [as 别名]
def query(cls):
for system in System.all(identity.current.user):
for group in system.groups:
yield CSV_GroupSystem(system, group)