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 request.setHeader('Cache-Control', 'no-cache') 14 15 # Get the parameters. 16 name = request.args.get("builder", [None])[0] 17 number = request.args.get("number", [None])[0] 18 if not name or not number: 19 return "builder and number parameter missing" 20 number = int(number) 21 22 # Check if the builder in parameter exists. 23 try: 24 builder = status.getBuilder(name) 25 except: 26 return "unknown builder" 27 28 # Check if the build in parameter exists. 29 build = builder.getBuild(int(number)) 30 if not build: 31 return "unknown build %s" % number 32 33 rows = ctx['rows'] = [] 34 35 # Display each step, starting by the last one. 36 for i in range(len(build.getSteps()) - 1, -1, -1): 37 step = build.getSteps()[i] 38 if step.isStarted() and step.getText(): 39 rows.append(IBox(step).getBox(request).td(align="center")) 40 41 # Display the bottom box with the build number in it. 42 ctx['build'] = IBox(build).getBox(request).td(align="center") 43 44 template = request.site.buildbot_service.templates.get_template("buildstatus.html") 45 data = template.render(**ctx) 46 47 # We want all links to display in a new tab/window instead of in the 48 # current one. 49 # TODO: Move to template 50 data = data.replace('<a ', '<a target="_blank"') 51 return data
52