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


Python Platform.all方法代码示例

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


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

示例1: get

# 需要导入模块: from models import Platform [as 别名]
# 或者: from models.Platform import all [as 别名]
    def get(self):
        self.response.headers['Content-Type'] = 'application/json; charset=utf-8';
        cache = memcache.get('dashboard')
        if cache:
            self.response.out.write(cache)
            return

        webkit_trunk = Branch.get_by_key_name('webkit-trunk')

        # FIXME: Determine popular branches, platforms, and tests
        dashboard = {
            'defaultBranch': 'WebKit trunk',
            'branchToId': {webkit_trunk.name: webkit_trunk.id},
            'platformToId': {},
            'testToId': {},
        }

        for platform in Platform.all():
            dashboard['platformToId'][platform.name] = platform.id

        for test in Test.all():
            dashboard['testToId'][test.name] = test.id

        result = json.dumps(dashboard)
        self.response.out.write(result)
        memcache.add('dashboard', result)
开发者ID:sohocoke,项目名称:webkit,代码行数:28,代码来源:dashboard_handler.py

示例2: get

# 需要导入模块: from models import Platform [as 别名]
# 或者: from models.Platform import all [as 别名]
    def get(self):
        self.response.headers["Content-Type"] = "application/json; charset=utf-8"

        cache = memcache.get("dashboard")
        if cache:
            self.response.out.write(cache)
            return

        webkitTrunk = Branch.get_by_key_name("webkit-trunk")

        # FIXME: Determine popular branches, platforms, and tests
        dashboard = {
            "defaultBranch": "WebKit trunk",
            "branchToId": {webkitTrunk.name: webkitTrunk.id},
            "platformToId": {},
            "testToId": {},
        }

        for platform in Platform.all():
            dashboard["platformToId"][platform.name] = platform.id

        for test in Test.all():
            dashboard["testToId"][test.name] = test.id

        result = json.dumps(dashboard)
        self.response.out.write(result)
        memcache.add("dashboard", result)
开发者ID:,项目名称:,代码行数:29,代码来源:

示例3: __init__

# 需要导入模块: from models import Platform [as 别名]
# 或者: from models.Platform import all [as 别名]
    def __init__(self):
        # FIXME: This function is massive. Break it up
        self._test_map = {}
        platform_id_map = {}
        branch_id_map = {}
        for test in Test.all():
            if test.hidden:
                continue

            branch_ids = [Branch.get(branch_key).id for branch_key in test.branches]
            platform_ids = [Platform.get(platform_key).id for platform_key in test.platforms]
            self._test_map[test.id] = {
                'name': test.name,
                'branchIds': branch_ids,
                'platformIds': platform_ids,
            }

            for platform_id in platform_ids:
                platform_id_map.setdefault(platform_id, {'tests': [], 'branches': []})
                platform_id_map[platform_id]['tests'].append(test.id)
                platform_id_map[platform_id]['branches'] += branch_ids

            for branch_id in branch_ids:
                branch_id_map.setdefault(branch_id, {'tests': [], 'platforms': []})
                branch_id_map[branch_id]['tests'].append(test.id)
                branch_id_map[branch_id]['platforms'] += platform_ids

        self._platform_map = {}
        for platform in Platform.all():
            if platform.id not in platform_id_map:
                continue

            if platform.hidden:
                for test_id in platform_id_map[platform.id]['tests']:
                    self._test_map[test_id]['platformIds'].remove(platform.id)
                for branch_id in platform_id_map[platform.id]['branches']:
                    branch_id_map[branch_id]['platforms'].remove(platform.id)
                continue

            self._platform_map[platform.id] = {
                'name': platform.name,
                'testIds': list(set(platform_id_map[platform.id]['tests'])),
                'branchIds': list(set(platform_id_map[platform.id]['branches'])),
            }

        self._branch_map = {}
        for branch in Branch.all():
            if branch.id not in branch_id_map:
                continue
            self._branch_map[branch.id] = {
                'name': branch.name,
                'testIds': list(set(branch_id_map[branch.id]['tests'])),
                'platformIds': list(set(branch_id_map[branch.id]['platforms'])),
            }
开发者ID:EQ4,项目名称:h5vcc,代码行数:56,代码来源:json_generators.py

示例4: __init__

# 需要导入模块: from models import Platform [as 别名]
# 或者: from models.Platform import all [as 别名]
    def __init__(self):
        # FIXME: Don't hard-code webkit-trunk here; ideally we want this be customizable.
        webkit_trunk = Branch.get_by_key_name('webkit-trunk')
        if not webkit_trunk:
            self._dashboard = None
            return

        # FIXME: Determine popular branches, platforms, and tests
        self._dashboard = {
            'defaultBranch': 'WebKit trunk',
            'branchToId': {webkit_trunk.name: webkit_trunk.id},
            'platformToId': {},
            'testToId': {},
        }

        for platform in Platform.all():
            self._dashboard['platformToId'][platform.name] = platform.id

        for test in Test.all():
            self._dashboard['testToId'][test.name] = test.id
开发者ID:,项目名称:,代码行数:22,代码来源:

示例5: get_platforms

# 需要导入模块: from models import Platform [as 别名]
# 或者: from models.Platform import all [as 别名]
 def get_platforms(self):
     self.response.headers['Content-Type'] = 'application/json'
     result = {}
     for platform in Platform.all().fetch(limit=100):
         result[platform.key().name()] = platform.name
     self.response.out.write(json.dumps(result))
开发者ID:,项目名称:,代码行数:8,代码来源:

示例6: get_platforms

# 需要导入模块: from models import Platform [as 别名]
# 或者: from models.Platform import all [as 别名]
 def get_platforms(self):
     self.response.headers['Content-Type'] = 'application/json'
     result = {}
     for platform in Platform.all():
         result[platform.key().name()] = {'name': platform.name, 'hidden': platform.hidden}
     self.response.out.write(json.dumps(result))
开发者ID:EQ4,项目名称:h5vcc,代码行数:8,代码来源:admin_handlers.py


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