+ start_response('200 OK', [
+ ('Content-type', 'text/html; charset=utf-8')])
+ yield "Unknown subfn %s" % subfn
+ elif fn == "host":
+ start_response('200 OK', [
+ ('Content-type', 'text/html; charset=utf-8')])
+ page = ViewHostPage(self.buildfarm)
+ yield "".join(self.html_page(form, page.render_html(myself, wsgiref.util.shift_path_info(environ))))
+ elif fn == "build":
+ build_checksum = wsgiref.util.shift_path_info(environ)
+ build = self.buildfarm.builds.get_by_checksum(build_checksum)
+ page = ViewBuildPage(self.buildfarm)
+ subfn = wsgiref.util.shift_path_info(environ)
+ if subfn == "+plain":
+ start_response('200 OK', [
+ ('Content-type', 'text/html; charset=utf-8')])
+ yield "".join(page.render(myself, build, True))
+ elif subfn == "+subunit":
+ start_response('200 OK', [
+ ('Content-type', 'text/x-subunit; charset=utf-8'),
+ ('Content-Disposition', 'attachment; filename="%s.%s.%s-%s.subunit"' % (build.tree, build.host, build.compiler, build.revision))])
+ try:
+ yield build.read_subunit().read()
+ except NoTestOutput:
+ yield "There was no test output"
+ elif subfn == "+stdout":
+ start_response('200 OK', [
+ ('Content-type', 'text/plain; charset=utf-8'),
+ ('Content-Disposition', 'attachment; filename="%s.%s.%s-%s.log"' % (build.tree, build.host, build.compiler, build.revision))])
+ yield build.read_log().read()
+ elif subfn == "+stderr":
+ start_response('200 OK', [
+ ('Content-type', 'text/plain; charset=utf-8'),
+ ('Content-Disposition', 'attachment; filename="%s.%s.%s-%s.err"' % (build.tree, build.host, build.compiler, build.revision))])
+ yield build.read_err().read()
+ elif subfn == "+subunit-diff":
+ start_response('200 OK', [
+ ('Content-type', 'text/plain; charset=utf-8')])
+ subunit_this = build.read_subunit().readlines()
+ other_build_checksum = wsgiref.util.shift_path_info(environ)
+ other_build = self.buildfarm.builds.get_by_checksum(other_build_checksum)
+ subunit_other = other_build.read_subunit().readlines()
+ import difflib
+ yield "".join(difflib.unified_diff(subunit_other, subunit_this))
+
+ elif subfn in ("", None):
+ start_response('200 OK', [
+ ('Content-type', 'text/html; charset=utf-8')])
+ yield "".join(self.html_page(form, page.render(myself, build, False)))
+ elif fn in ("", None):
+ start_response('200 OK', [
+ ('Content-type', 'text/html; charset=utf-8')])
+ page = ViewSummaryPage(self.buildfarm)
+ yield "".join(self.html_page(form, page.render_html(myself)))
+ else:
+ start_response('404 Page Not Found', [
+ ('Content-type', 'text/html; charset=utf-8')])
+ yield "Unknown function %s" % fn