2 from twisted
.web
import html
5 from buildbot
.status
.web
.base
import HtmlResource
6 from buildbot
.status
.web
.logs
import LogsResource
8 # builders/$builder/builds/$buildnum/steps/$stepname
9 class StatusResourceBuildStep(HtmlResource
):
13 def __init__(self
, build_status
, step_status
):
14 HtmlResource
.__init
__(self
)
15 self
.status
= build_status
16 self
.step_status
= step_status
21 builder_name
= b
.getBuilder().getName()
22 build_num
= b
.getNumber()
24 data
+= ("<h1>BuildStep <a href=\"../../../../%s\">%s</a>:" %
25 (urllib
.quote(builder_name
), builder_name
))
26 data
+= "<a href=\"../../%d\">#%d</a>" % (build_num
, build_num
)
27 data
+= ":%s</h1>\n" % s
.getName()
30 data
+= ("<h2>Finished</h2>\n"
31 "<p>%s</p>\n" % html
.escape("%s" % s
.getText()))
33 data
+= ("<h2>Not Finished</h2>\n"
34 "<p>ETA %s seconds</p>\n" % s
.getETA())
36 exp
= s
.getExpectations()
38 data
+= ("<h2>Expectations</h2>\n"
41 data
+= "<li>%s: current=%s, target=%s</li>\n" % \
42 (html
.escape(e
[0]), e
[1], e
[2])
46 data
+= ("<h2>Logs</h2>\n"
49 if logfile
.hasContents():
50 # FIXME: If the step name has a / in it, this is broken
51 # either way. If we quote it but say '/'s are safe,
52 # it chops up the step name. If we quote it and '/'s
53 # are not safe, it escapes the / that separates the
54 # step name from the log number.
55 logname
= logfile
.getName()
56 logurl
= req
.childLink("logs/%s" % urllib
.quote(logname
))
57 data
+= ('<li><a href="%s">%s</a></li>\n' %
58 (logurl
, html
.escape(logname
)))
60 data
+= '<li>%s</li>\n' % html
.escape(logname
)
65 def getChild(self
, path
, req
):
67 return LogsResource(self
.step_status
)
68 return HtmlResource
.getChild(self
, path
, req
)
72 class StepsResource(HtmlResource
):
75 def __init__(self
, build_status
):
76 HtmlResource
.__init
__(self
)
77 self
.build_status
= build_status
79 def getChild(self
, path
, req
):
80 for s
in self
.build_status
.getSteps():
81 if s
.getName() == path
:
82 return StatusResourceBuildStep(self
.build_status
, s
)
83 return HtmlResource
.getChild(self
, path
, req
)