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

Source Code for Module buildbot.status.web.root

 1  from twisted.web.util import redirectTo 
 2  from twisted.python import log 
 3  from twisted.internet import reactor 
 4   
 5  from buildbot.status.web.base import HtmlResource, path_to_root, path_to_authfail 
 6  from buildbot.util.eventual import eventually 
 7   
8 -class RootPage(HtmlResource):
9 title = "Buildbot" 10
11 - def content(self, request, cxt):
12 status = self.getStatus(request) 13 14 if request.path == '/shutdown': 15 if self.getAuthz(request).actionAllowed("cleanShutdown", request): 16 eventually(status.cleanShutdown) 17 return redirectTo("/", request) 18 else: 19 return redirectTo(path_to_authfail(request), request) 20 elif request.path == '/cancel_shutdown': 21 if self.getAuthz(request).actionAllowed("cleanShutdown", request): 22 eventually(status.cancelCleanShutdown) 23 return redirectTo("/", request) 24 else: 25 return redirectTo(path_to_authfail(request), request) 26 27 cxt.update( 28 shutting_down = status.shuttingDown, 29 shutdown_url = request.childLink("shutdown"), 30 cancel_shutdown_url = request.childLink("cancel_shutdown"), 31 ) 32 template = request.site.buildbot_service.templates.get_template("root.html") 33 return template.render(**cxt)
34