1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 from zope.interface import implements
18 from twisted.python import components
19 from twisted.web.error import NoResource
20
21 from buildbot.changes.changes import Change
22 from buildbot.status.web.base import HtmlResource, IBox, Box
23
26 self.changeid = changeid
27 self.pageTitle = "Change #%d" % changeid
28
29 - def content(self, req, cxt):
30 d = self.getStatus(req).getChange(self.changeid)
31 def cb(change):
32 if not change:
33 return "No change number %d" % self.changeid
34 templates = req.site.buildbot_service.templates
35 cxt['c'] = change.asDict()
36 template = templates.get_template("change.html")
37 data = template.render(cxt)
38 return data
39 d.addCallback(cb)
40 return d
41
42
44
45 - def content(self, req, cxt):
46 cxt['sources'] = self.getStatus(req).getChangeSources()
47 template = req.site.buildbot_service.templates.get_template("change_sources.html")
48 return template.render(**cxt)
49
51 try:
52 changeid = int(path)
53 except ValueError:
54 return NoResource("Expected a change number")
55
56 return ChangeResource(changeid)
57
59 implements(IBox)
60
62 url = req.childLink("../changes/%d" % self.original.number)
63 template = req.site.buildbot_service.templates.get_template("change_macros.html")
64 text = template.module.box_contents(url=url,
65 who=self.original.getShortAuthor(),
66 pageTitle=self.original.comments)
67 return Box([text], class_="Change")
68 components.registerAdapter(ChangeBox, Change, IBox)
69