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

Source Code for Module buildbot.status.web.step

 1   
 2  import urllib 
 3  from buildbot.status.web.base import HtmlResource, path_to_builder, \ 
 4       path_to_build, css_classes 
 5  from buildbot.status.web.logs import LogsResource 
 6  from buildbot import util 
 7  from time import ctime 
 8   
 9  # /builders/$builder/builds/$buildnum/steps/$stepname 
10 -class StatusResourceBuildStep(HtmlResource):
11 title = "Build Step" 12 addSlash = True 13
14 - def __init__(self, build_status, step_status):
18
19 - def content(self, req, cxt):
20 s = self.step_status 21 b = s.getBuild() 22 23 logs = cxt['logs'] = [] 24 for l in s.getLogs(): 25 # FIXME: If the step name has a / in it, this is broken 26 # either way. If we quote it but say '/'s are safe, 27 # it chops up the step name. If we quote it and '/'s 28 # are not safe, it escapes the / that separates the 29 # step name from the log number. 30 logs.append({'has_contents': l.hasContents(), 31 'name': l.getName(), 32 'link': req.childLink("logs/%s" % urllib.quote(l.getName())) }) 33 34 start, end = s.getTimes() 35 36 if start: 37 cxt['start'] = ctime(start) 38 if end: 39 cxt['end'] = ctime(end) 40 cxt['elapsed'] = util.formatInterval(end - start) 41 else: 42 cxt['end'] = "Not Finished" 43 cxt['elapsed'] = util.formatInterval(util.now() - start) 44 45 cxt.update(dict(builder_link = path_to_builder(req, b.getBuilder()), 46 build_link = path_to_build(req, b), 47 b = b, 48 s = s, 49 result_css = css_classes[b.getResults()])) 50 51 template = req.site.buildbot_service.templates.get_template("buildstep.html"); 52 return template.render(**cxt)
53
54 - def getChild(self, path, req):
55 if path == "logs": 56 return LogsResource(self.step_status) 57 return HtmlResource.getChild(self, path, req)
58 59 60 61 # /builders/$builder/builds/$buildnum/steps
62 -class StepsResource(HtmlResource):
63 addSlash = True 64
65 - def __init__(self, build_status):
68
69 - def content(self, req, ctx):
70 return "subpages show data for each step"
71
72 - def getChild(self, path, req):
73 for s in self.build_status.getSteps(): 74 if s.getName() == path: 75 return StatusResourceBuildStep(self.build_status, s) 76 return HtmlResource.getChild(self, path, req)
77