Ticket #162: pubhtml.patch
| File pubhtml.patch, 4.3 kB (added by dustin, 1 year ago) |
|---|
-
buildbot/buildbot/status/web/baseweb.py
old new 311 311 /xmlrpc : (not yet implemented) an XMLRPC server with build status 312 312 313 313 314 All URLs for pages which are not defined here are used to look for files 315 in BASEDIR/public_html/ , which means that /robots.txt or /buildbot.css 316 or /favicon.ico can be placed in that directory. 314 All URLs for pages which are not defined here are used to look 315 for files in PUBLIC_HTML, which defaults to BASEDIR/public_html. 316 This means that /robots.txt or /buildbot.css or /favicon.ico can 317 be placed in that directory. 317 318 318 319 If an index file (index.html, index.htm, or index, in that order) is 319 present in public_html/, it will be used for the root resource. If not,320 present in PUBLIC_HTML, it will be used for the root resource. If not, 320 321 the default behavior is to put a redirection to the /waterfall page. 321 322 322 323 All of the resources provided by this service use relative URLs to reach … … 325 326 bottom. 326 327 327 328 This webserver defines class attributes on elements so they can be styled 328 with CSS stylesheets. All pages pull in public_html/buildbot.css, and you329 with CSS stylesheets. All pages pull in PUBLIC_HTML/buildbot.css, and you 329 330 can cause additional stylesheets to be loaded by adding a suitable <link> 330 331 to the WebStatus instance's .head_elements attribute. 331 332 … … 354 355 # not (we'd have to do a recursive traversal of all children to discover 355 356 # all the changes). 356 357 357 def __init__(self, http_port=None, distrib_port=None, allowForce=False): 358 def __init__(self, http_port=None, distrib_port=None, allowForce=False, 359 public_html=None): 358 360 """Run a web server that provides Buildbot status. 359 361 360 362 @type http_port: int or L{twisted.application.strports} string … … 387 389 'unix:/home/buildbot/.twistd-web-pb'. Providing 388 390 a non-absolute pathname will probably confuse 389 391 the strports parser. 392 390 393 @param allowForce: boolean, if True then the webserver will allow 391 394 visitors to trigger and cancel builds 395 396 @param public_html: the path to the public_html directory for this display, 397 either absolute or relative to the basedir. The default 398 is 'public_html', which selects BASEDIR/public_html. 392 399 """ 393 400 394 401 service.MultiService.__init__(self) … … 402 409 distrib_port = "unix:%s" % distrib_port 403 410 self.distrib_port = distrib_port 404 411 self.allowForce = allowForce 412 self.public_html = public_html 405 413 406 414 # this will be replaced once we've been attached to a parent (and 407 # thus have a basedir and can reference BASEDIR /public_html/)415 # thus have a basedir and can reference BASEDIR) 408 416 root = static.Data("placeholder", "text/plain") 409 417 self.site = server.Site(root) 410 418 self.childrenToBeAdded = {} … … 462 470 def setupSite(self): 463 471 # this is responsible for creating the root resource. It isn't done 464 472 # at __init__ time because we need to reference the parent's basedir. 465 htmldir = os.path. join(self.parent.basedir, "public_html")473 htmldir = os.path.abspath(os.path.join(self.parent.basedir, self.public_html)) 466 474 if os.path.isdir(htmldir): 467 475 log.msg("WebStatus using (%s)" % htmldir) 468 476 else: … … 516 524 # always redirects to a WaterfallStatusResource, and the old arguments are 517 525 # mapped into the new resource-tree approach. In the normal WebStatus, the 518 526 # root resource either redirects the browser to /waterfall or serves 519 # BASEDIR/public_html/index.html, and favicon/robots.txt are provided by520 # having the admin write actual files into BASEDIR/public_html/ .527 # PUBLIC_HTML/index.html, and favicon/robots.txt are provided by 528 # having the admin write actual files into PUBLIC_HTML/ . 521 529 522 530 # note: we don't use a util.Redirect here because HTTP requires that the 523 531 # Location: header provide an absolute URI, and it's non-trivial to figure
![[Buildbot Logo]](/trac/chrome/site/header-text-transparent.png)