Package buildbot :: Package status :: Package web :: Module buildstatus
[frames] | no frames]

Source Code for Module buildbot.status.web.buildstatus

 1  from buildbot.status.web.base import HtmlResource, IBox 
 2   
3 -class BuildStatusStatusResource(HtmlResource):
4 - def __init__(self, categories=None):
6
7 - def content(self, request, ctx):
8 """Display a build in the same format as the waterfall page. 9 The HTTP GET parameters are the builder name and the build 10 number.""" 11 12 status = self.getStatus(request) 13 14 # Get the parameters. 15 name = request.args.get("builder", [None])[0] 16 number = request.args.get("number", [None])[0] 17 if not name or not number: 18 return "builder and number parameter missing" 19 number = int(number) 20 21 # Check if the builder in parameter exists. 22 try: 23 builder = status.getBuilder(name) 24 except: 25 return "unknown builder" 26 27 # Check if the build in parameter exists. 28 build = builder.getBuild(int(number)) 29 if not build: 30 return "unknown build %s" % number 31 32 rows = ctx['rows'] = [] 33 34 # Display each step, starting by the last one. 35 for i in range(len(build.getSteps()) - 1, -1, -1): 36 step = build.getSteps()[i] 37 if step.isStarted() and step.getText(): 38 rows.append(IBox(step).getBox(request).td(align="center")) 39 40 # Display the bottom box with the build number in it. 41 ctx['build'] = IBox(build).getBox(request).td(align="center") 42 43 template = request.site.buildbot_service.templates.get_template("buildstatus.html") 44 data = template.render(**ctx) 45 46 # We want all links to display in a new tab/window instead of in the 47 # current one. 48 # TODO: Move to template 49 data = data.replace('<a ', '<a target="_blank"') 50 return data
51