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


Python Box.td方法代码示例

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


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

示例1: body

# 需要导入模块: from buildbot.status.web.base import Box [as 别名]
# 或者: from buildbot.status.web.base.Box import td [as 别名]
    def body(self, req):
        from twisted.web import html
        status = self.getStatus(req)
        control = self.getControl(req)

        builders = req.args.get("builder", status.getBuilderNames())
        branches = [b for b in req.args.get("branch", []) if b]

        building = False
        online = 0
        
        base_builders_url = self.path_to_root(req) + "builders/"
        all_builders = [html.escape(bn) for bn in builders]
        trunk_builders = [bn for bn in all_builders if bn.startswith('trunk')]
        stable_builders = [bn for bn in all_builders if bn.startswith('stable')]  
        trunk_builders_link = 'waterfall?builder='+'&builder='.join(trunk_builders)
        stable_builders_link = 'waterfall?builder=' + '&builder='.join(stable_builders)
        tr_b = False
        st_b = False
        data = ""
        data += "<table class='grid' id='latest_builds'>"
        for bn in all_builders:
            if (bn.startswith('stable')) and (not st_b):
                st_b = True
                data += "<table class='grid' id='stable_builds'>\n"
                data += "<tr class='grid-header'><td class='grid-cell'><span>Latest Stable</span></td><td class='grid-cell'><a href=%s>Stable Tests</a></td><td class='grid-cell'><a href='Changelog/5.0'>Changelog</a></td></tr><\n>"[:-3]%(stable_builders_link)
            if (bn.startswith('trunk')) and (not tr_b):
                tr_b = True
                data += "<tr id='trunk_builds'><td colspan='3'></td>"
                data += "<tr class='grid-header'><td class='grid-cell'><span>Latest Trunk</span></td><td class='grid-cell'><a href='%s'>Trunk Tests</a></td><td class='grid-cell'><a href='Changelog/trunk'>Changelog</a></td></tr><\n>"[:-3]%(trunk_builders_link)
                 
            base_builder_url = base_builders_url + urllib.quote(bn, safe='')
            builder = status.getBuilder(bn)
            data += "<tr class='grid-row'>\n"
            data += '<td class="grid-cell"><a href="%s">%s</a></td>\n' \
                  % (base_builder_url, html.escape(bn))
            builds = list(builder.generateFinishedBuilds(map_branches(branches),
                                                         num_builds=1))
            if builds:
                b = builds[0]
                url = (base_builder_url + "/builds/%d" % b.getNumber())
                try:
                    label = b.getProperty("got_revision")
                except KeyError:
                    label = None
                if not label or len(str(label)) > 20:
                    label = "#%d" % b.getNumber()
                text = ['<a href="%s">%s</a>' % (url, label)]
                text.append(' '.join(b.getText()))
                box = Box(text, b.getColor(),
                        class_="LastBuild box %s" % build_get_class(b))
                data += box.td(class_="grid-cell",align="center")
            else:
                data += '<td class="grid-cell" align="center">no build</td>\n'
            current_box = ICurrentBox(builder).getBox(status)            
            data += current_box.td(class_="grid-cell",align="center")
            data+='</tr>'
            
            builder_status = builder.getState()[0]
            if builder_status == "building":
                building = True
                online += 1
            elif builder_status != "offline":
                online += 1

        data += "</table></table>\n"        
        if control is not None:
            if building:
                stopURL = "builders/_all/stop"
                data += make_stop_form(stopURL, True, "Builds")
            if online:
                forceURL = "builders/_all/force"
                data += make_force_build_form(forceURL, True)
        return data
开发者ID:hunslater,项目名称:openerp-buildbot,代码行数:76,代码来源:web.py


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