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

Source Code for Module buildbot.status.web.changes

 1   
 2  from zope.interface import implements 
 3  from twisted.python import components 
 4  from twisted.web.error import NoResource 
 5   
 6  from buildbot.changes.changes import Change 
 7  from buildbot.status.web.base import HtmlResource, StaticHTML, IBox, Box 
 8   
 9  # /changes/NN 
10 -class ChangesResource(HtmlResource):
11
12 - def body(self, req):
13 data = "" 14 data += "Change sources:\n" 15 sources = self.getStatus(req).getChangeSources() 16 if sources: 17 data += "<ol>\n" 18 for s in sources: 19 data += "<li>%s</li>\n" % s.describe() 20 data += "</ol>\n" 21 else: 22 data += "none (push only)\n" 23 return data
24
25 - def getChild(self, path, req):
26 num = int(path) 27 c = self.getStatus(req).getChange(num) 28 if not c: 29 return NoResource("No change number '%d'" % num) 30 return StaticHTML(c.asHTML(), "Change #%d" % num)
31 32
33 -class ChangeBox(components.Adapter):
34 implements(IBox) 35
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], class_="Change")
40 components.registerAdapter(ChangeBox, Change, IBox) 41