1   
 2   
 3   
 4   
 5   
 6   
 7   
 8   
 9   
10   
11   
12   
13   
14   
15   
16   
17  import urllib 
18  from buildbot.status.web.base import HtmlResource, path_to_builder, \ 
19       path_to_build, css_classes 
20  from buildbot.status.web.logs import LogsResource 
21  from buildbot import util 
22  from time import ctime 
23   
24   
26      pageTitle = "Build Step" 
27      addSlash = True 
28   
29 -    def __init__(self, build_status, step_status): 
 33   
34 -    def content(self, req, cxt): 
 35          s = self.step_status 
36          b = s.getBuild() 
37   
38          logs = cxt['logs'] = []         
39          for l in s.getLogs(): 
40               
41               
42               
43               
44               
45              logs.append({'has_contents': l.hasContents(), 
46                           'name': l.getName(), 
47                           'link': req.childLink("logs/%s" % urllib.quote(l.getName())) }) 
48   
49          start, end = s.getTimes() 
50           
51          if start: 
52              cxt['start'] = ctime(start) 
53              if end: 
54                  cxt['end'] = ctime(end) 
55                  cxt['elapsed'] = util.formatInterval(end - start) 
56              else: 
57                  cxt['end'] = "Not Finished" 
58                  cxt['elapsed'] = util.formatInterval(util.now() - start) 
59                   
60          cxt.update(dict(builder_link = path_to_builder(req, b.getBuilder()), 
61                          build_link = path_to_build(req, b), 
62                          b = b, 
63                          s = s, 
64                          result_css = css_classes[s.getResults()[0]])) 
65           
66          template = req.site.buildbot_service.templates.get_template("buildstep.html");         
67          return template.render(**cxt) 
 68   
 73   
74   
75   
76   
78      addSlash = True 
79   
83   
84 -    def content(self, req, ctx): 
 85          return "subpages show data for each step" 
 86   
 92