当前位置: 首页>>代码示例>>Python>>正文


Python OSMajor.ordered_by_osmajor方法代码示例

本文整理汇总了Python中bkr.server.model.OSMajor.ordered_by_osmajor方法的典型用法代码示例。如果您正苦于以下问题:Python OSMajor.ordered_by_osmajor方法的具体用法?Python OSMajor.ordered_by_osmajor怎么用?Python OSMajor.ordered_by_osmajor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bkr.server.model.OSMajor的用法示例。


在下文中一共展示了OSMajor.ordered_by_osmajor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: index

# 需要导入模块: from bkr.server.model import OSMajor [as 别名]
# 或者: from bkr.server.model.OSMajor import ordered_by_osmajor [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)
开发者ID:sibiaoluo,项目名称:beaker,代码行数:28,代码来源:reserve_workflow.py

示例2: index

# 需要导入模块: from bkr.server.model import OSMajor [as 别名]
# 或者: from bkr.server.model.OSMajor import ordered_by_osmajor [as 别名]
    def index(self, **kwargs):
        # CherryPy will give us distro_tree_id as a scalar if it only has one 
        # value, but we want it to always be a list of int
        if not kwargs.get('distro_tree_id'):
            kwargs['distro_tree_id'] = []
        elif not isinstance(kwargs['distro_tree_id'], list):
            kwargs['distro_tree_id'] = [int(kwargs['distro_tree_id'])]
        else:
            kwargs['distro_tree_id'] = [int(x) for x in kwargs['distro_tree_id']]

        # If we got a distro_tree_id but no osmajor or distro, fill those in 
        # with the right values so that the distro picker is populated properly
        if kwargs['distro_tree_id']:
            distro_tree = DistroTree.by_id(kwargs['distro_tree_id'][0])
            if not kwargs.get('distro'):
                kwargs['distro'] = distro_tree.distro.name
            if not kwargs.get('osmajor'):
                kwargs['osmajor'] = distro_tree.distro.osversion.osmajor.osmajor

        options = {}
        options['tag'] = [tag.tag for tag in DistroTag.used()]
        options['osmajor'] = [osmajor.osmajor for osmajor in
                OSMajor.ordered_by_osmajor(OSMajor.in_any_lab())]
        options['distro'] = self._get_distro_options(
                osmajor=kwargs.get('osmajor'), tag=kwargs.get('tag'))
        options['distro_tree_id'] = self._get_distro_tree_options(
                distro=kwargs.get('distro'))
        options['lab'] = [lc.fqdn for lc in
                LabController.query.filter(LabController.removed == None)]
        return dict(title=_(u'Reserve Workflow'),
                selection=kwargs, options=options)
开发者ID:ShaolongHu,项目名称:beaker,代码行数:33,代码来源:reserve_workflow.py

示例3: index

# 需要导入模块: from bkr.server.model import OSMajor [as 别名]
# 或者: from bkr.server.model.OSMajor import ordered_by_osmajor [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)
开发者ID:ustbgaofan,项目名称:beaker,代码行数:29,代码来源:reserve_workflow.py


注:本文中的bkr.server.model.OSMajor.ordered_by_osmajor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。