Ejemplo n.º 1
0
 def render_GET(self, request):
     email = self.getRequestEmail(request)
     request.setHeader('content-type', 'text/html; charset=utf-8')
     element = tags.html(
         htmlHead,
         tags.body(tags.form(
             tags.fieldset(
                 tags.div(
                     tags.label('Cert e-mail'),
                     tags.label('Username', for_='username'),
                     tags.label('Password', for_='password'),
                     tags.label('Site', for_='site', class_='last'),
                     id='names',
                 ),
                 tags.div(
                     tags.input(disabled='true', value=email),
                     tags.input(name='username', type='text'),
                     tags.input(name='password', type='password'),
                     tags.input(name='site', type='url', class_='last'),
                     id='fields',
                 ),
             ),
             tags.button('Generate', type='submit'),
             action='', method='POST',
         )),
     )
     return renderElement(request, element)
Ejemplo n.º 2
0
    def body(self, req):
        status = self.getStatus(req)
        authz = self.getAuthz(req)

        builders = req.args.get(
            "builder", status.getBuilderNames(categories=self.categories))
        branches = [b for b in req.args.get("branch", []) if b]
        if not branches:
            branches = ["master"]
        if branches and "master" not in branches:
            defaultCount = "1"
        else:
            defaultCount = "10"
        num_builds = int(req.args.get("num_builds", [defaultCount])[0])

        tag = tags.div()

        tag(tags.script(src="hlbb.js"))
        tag(
            tags.h2(style="float:left; margin-top:0")("Latest builds: ",
                                                      ", ".join(branches)))

        form = tags.form(method="get",
                         action="",
                         style="float:right",
                         onsubmit="return checkBranch(branch.value)")
        form(
            tags.input(type="test",
                       name="branch",
                       placeholder=branches[0],
                       size="40"))
        form(tags.input(type="submit", value="View"))
        if (yield authz.actionAllowed('forceAllBuilds', req)):
            # XXX: Unsafe interpolation
            form(
                tags.button(type="button",
                            onclick="forceBranch(branch.value || %r, %r)" % (
                                branches[0],
                                self.categories,
                            ))("Force"))
        tag(form)

        table = tags.table(style="clear:both")
        tag(table)

        for bn in filter(lambda bn: bn not in self.failing_builders, builders):
            table(self.builder_row(bn, req, branches, num_builds))

        table(tags.tr()(tags.td(colspan="100")(
            tags.h3(style="float:left; margin-top:0")("Expected failures: "))))

        for bn in filter(lambda bn: bn in self.failing_builders, builders):
            table(self.builder_row(bn, req, branches, num_builds))

        defer.returnValue((yield flattenString(req, tag)))
Ejemplo n.º 3
0
    def body(self, req):
        status = self.getStatus(req)
        authz = self.getAuthz(req)

        builders = req.args.get(
            "builder", status.getBuilderNames(categories=self.categories))
        branches = [b for b in req.args.get("branch", []) if b]
        if not branches:
            branches = ["master"]
        if branches and "master" not in branches:
            defaultCount = "1"
        else:
            defaultCount = "10"
        num_builds = int(req.args.get("num_builds", [defaultCount])[0])

        tag = tags.div()

        tag(tags.script(src="hlbb.js"))
        tag(tags.h2(style="float:left; margin-top:0")
                   ("Latest builds: ", ", ".join(branches)))

        form = tags.form(method="get", action="", style="float:right",
                         onsubmit="return checkBranch(branch.value)")
        form(tags.input(type="test", name="branch",
                        placeholder=branches[0], size="40"))
        form(tags.input(type="submit", value="View"))
        if (yield authz.actionAllowed('forceAllBuilds', req)):
            # XXX: Unsafe interpolation
            form(tags.button(
                type="button",
                onclick="forceBranch(branch.value || %r, %r)"
                        % (branches[0], self.categories,)
                )("Force"))
        tag(form)

        table = tags.table(style="clear:both")
        tag(table)

        for bn in filter(lambda bn: bn not in self.failing_builders, builders):
            table(self.builder_row(bn, req, branches, num_builds))

        table(tags.tr()(tags.td(colspan="100")(
            tags.h3(style="float:left; margin-top:0")
                   ("Expected failures: "))))

        for bn in filter(lambda bn: bn in self.failing_builders, builders):
            table(self.builder_row(bn, req, branches, num_builds))

        defer.returnValue((yield flattenString(req, tag)))
Ejemplo n.º 4
0
    def body(self, req):
        status = self.getStatus(req)
        authz = self.getAuthz(req)

        builders = req.args.get(
            "builder", status.getBuilderNames(categories=self.categories))
        branches = [b for b in req.args.get("branch", []) if b]
        if not branches:
            branches = ["trunk"]
        if branches and "trunk" not in branches:
            defaultCount = "1"
        else:
            defaultCount = "10"
        num_builds = int(req.args.get("num_builds", [defaultCount])[0])

        tag = tags.div()

        tag(tags.script(src="txbuildbot.js"))
        tag(
            tags.h2(style="float:left; margin-top:0")("Latest builds: ",
                                                      ", ".join(branches)))

        form = tags.form(method="get",
                         action="",
                         style="float:right",
                         onsubmit="return checkBranch(branch.value)")
        form(
            tags.input(type="test",
                       name="branch",
                       placeholder=branches[0],
                       size="40"))
        form(tags.input(type="submit", value="View"))
        if (yield authz.actionAllowed('forceAllBuilds', req)):
            # XXX: Unsafe interpolation
            form(
                tags.button(type="button",
                            onclick="forceBranch(branch.value || %r, %r)" % (
                                branches[0],
                                self.categories,
                            ))("Force"))
        tag(form)

        table = tags.table(style="clear:both")
        tag(table)

        for bn in builders:
            builder = status.getBuilder(bn)
            state = builder.getState()[0]
            if state == 'building':
                state = 'idle'
            row = tags.tr()
            table(row)
            builderLink = path_to_builder(req, builder)
            row(
                tags.td(class_="box %s" % (state, ))(
                    tags.a(href=builderLink)(bn)))

            builds = sorted([
                build for build in builder.getCurrentBuilds()
                if build.getSourceStamp().branch in map_branches(branches)
            ],
                            key=lambda build: build.getNumber(),
                            reverse=True)

            builds.extend(
                builder.generateFinishedBuilds(map_branches(branches),
                                               num_builds=num_builds))
            if builds:
                for b in builds:
                    url = path_to_build(req, b)
                    try:
                        label = b.getProperty("got_revision")
                    except KeyError:
                        label = None
                    # Label should never be "None", but sometimes
                    # buildbot has disgusting bugs.
                    if not label or label == "None" or len(str(label)) > 20:
                        label = "#%d" % b.getNumber()
                    if b.isFinished():
                        text = b.getText()
                    else:
                        when = b.getETA()
                        if when:
                            text = [
                                "%s" % (formatInterval(when), ),
                                "%s" % (time.strftime(
                                    "%H:%M:%S",
                                    time.localtime(time.time() + when)), )
                            ]
                        else:
                            text = []

                    row(
                        tags.td(
                            align="center",
                            bgcolor=_backgroundColors[b.getResults()],
                            class_=("LastBuild box ", build_get_class(b)))([
                                (element, tags.br)
                                for element in [tags.a(href=url)(label)] + text
                            ]))
            else:
                row(tags.td(class_="LastBuild box")("no build"))
        defer.returnValue((yield flattenString(req, tag)))
Ejemplo n.º 5
0
Archivo: web.py Proyecto: rodrigc/braid
    def body(self, req):
        status = self.getStatus(req)
        authz = self.getAuthz(req)

        builders = req.args.get("builder", status.getBuilderNames(categories=self.categories))
        branches = [b for b in req.args.get("branch", []) if b]
        if not branches:
            branches = ["trunk"]
        if branches and "trunk" not in branches:
            defaultCount = "1"
        else:
            defaultCount = "10"
        num_builds = int(req.args.get("num_builds", [defaultCount])[0])

        tag = tags.div()

        tag(tags.script(src="txbuildbot.js"))
        tag(tags.h2(style="float:left; margin-top:0")("Latest builds: ", ", ".join(branches)))

        form = tags.form(method="get", action="", style="float:right",
                         onsubmit="return checkBranch(branch.value)")
        form(tags.input(type="test", name="branch", placeholder=branches[0], size="40"))
        form(tags.input(type="submit", value="View"))
        if (yield authz.actionAllowed('forceAllBuilds', req)):
            # XXX: Unsafe interpolation
            form(tags.button(type="button",
                onclick="forceBranch(branch.value || %r, %r)"
                        % (branches[0], self.categories,)
                )("Force"))
        tag(form)


        table = tags.table(style="clear:both")
        tag(table)

        for bn in builders:
            builder = status.getBuilder(bn)
            state = builder.getState()[0]
            if state == 'building':
                state = 'idle'
            row = tags.tr()
            table(row)
            builderLink = path_to_builder(req, builder)
            row(tags.td(class_="box %s" % (state,))(tags.a(href=builderLink)(bn)))

            builds = sorted([
                    build for build in builder.getCurrentBuilds()
                    if build.getSourceStamps()[0].branch in map_branches(branches)
                    ], key=lambda build: build.getNumber(), reverse=True)

            builds.extend(builder.generateFinishedBuilds(map_branches(branches),
                                                         num_builds=num_builds))
            if builds:
                for b in builds:
                    url = path_to_build(req, b)
                    try:
                        label = b.getProperty("got_revision")
                    except KeyError:
                        label = None
                    # Label should never be "None", but sometimes
                    # buildbot has disgusting bugs.
                    if not label or label == "None" or len(str(label)) > 20:
                        label = "#%d" % b.getNumber()
                    if b.isFinished():
                        text = b.getText()
                    else:
                        when = b.getETA()
                        if when:
                            text = [
                                "%s" % (formatInterval(when),),
                                "%s" % (time.strftime("%H:%M:%S", time.localtime(time.time() + when)),)
                                ]
                        else:
                            text = []

                    row(tags.td(
                            align="center",
                            bgcolor=_backgroundColors[b.getResults()],
                            class_=("LastBuild box ", build_get_class(b)))([
                                (element, tags.br)
                                for element
                                in [tags.a(href=url)(label)] + text]) )
            else:
                row(tags.td(class_="LastBuild box")("no build"))
        defer.returnValue((yield flattenString(req, tag)))