2 from zope
.interface
import implements
3 from twisted
.python
import components
4 from twisted
.web
.error
import NoResource
6 from buildbot
.changes
.changes
import Change
7 from buildbot
.status
.web
.base
import HtmlResource
, StaticHTML
, IBox
, Box
10 class ChangesResource(HtmlResource
):
14 data
+= "Change sources:\n"
15 sources
= self
.getStatus(req
).getChangeSources()
19 data
+= "<li>%s</li>\n" % s
.describe()
22 data
+= "none (push only)\n"
25 def getChild(self
, path
, req
):
27 c
= self
.getStatus(req
).getChange(num
)
29 return NoResource("No change number '%d'" % num
)
30 return StaticHTML(c
.asHTML(), "Change #%d" % num
)
33 class ChangeBox(components
.Adapter
):
36 def getBox(self
, req
):
37 url
= req
.childLink("../changes/%d" % self
.original
.number
)
38 text
= self
.original
.get_HTML_box(url
)
39 return Box([text
], color
="white", class_
="Change")
40 components
.registerAdapter(ChangeBox
, Change
, IBox
)