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

Source Code for Module buildbot.status.web.root

 1  # This file is part of Buildbot.  Buildbot is free software: you can 
 2  # redistribute it and/or modify it under the terms of the GNU General Public 
 3  # License as published by the Free Software Foundation, version 2. 
 4  # 
 5  # This program is distributed in the hope that it will be useful, but WITHOUT 
 6  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 7  # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 8  # details. 
 9  # 
10  # You should have received a copy of the GNU General Public License along with 
11  # this program; if not, write to the Free Software Foundation, Inc., 51 
12  # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
13  # 
14  # Copyright Buildbot Team Members 
15   
16  from twisted.web.util import redirectTo 
17   
18  from buildbot.status.web.base import HtmlResource, path_to_authfail 
19  from buildbot.util.eventual import eventually 
20   
21 -class RootPage(HtmlResource):
22 title = "Buildbot" 23
24 - def content(self, request, cxt):
25 status = self.getStatus(request) 26 27 if request.path == '/shutdown': 28 if self.getAuthz(request).actionAllowed("cleanShutdown", request): 29 eventually(status.cleanShutdown) 30 return redirectTo("/", request) 31 else: 32 return redirectTo(path_to_authfail(request), request) 33 elif request.path == '/cancel_shutdown': 34 if self.getAuthz(request).actionAllowed("cleanShutdown", request): 35 eventually(status.cancelCleanShutdown) 36 return redirectTo("/", request) 37 else: 38 return redirectTo(path_to_authfail(request), request) 39 40 cxt.update( 41 shutting_down = status.shuttingDown, 42 shutdown_url = request.childLink("shutdown"), 43 cancel_shutdown_url = request.childLink("cancel_shutdown"), 44 ) 45 template = request.site.buildbot_service.templates.get_template("root.html") 46 return template.render(**cxt)
47