[Buildbot-commits] buildbot/buildbot/status html.py,1.49,1.50

Brian Warner warner at users.sourceforge.net
Tue Feb 1 08:36:48 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot/status
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27597/buildbot/status

Modified Files:
	html.py 
Log Message:
(TextLog.getChild): use a /text child URL, such as
http://foo.com/svn-hello/builds/1/test/0/text instead of
http://foo.com/svn-hello/builds/1/test/0 , to retrieve the logfile as
text/plain (no markup, no headers). This replaces the previous scheme (which
used an ?text=1 argument), and gets us back to a relative link (which works
better when the buildbot lives behind another web server, such as Apache
configured as a reverse proxy). Thanks to Gerald Combs for spotting the
problem.


Index: html.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/html.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- html.py	9 Dec 2004 10:26:13 -0000	1.49
+++ html.py	1 Feb 2005 08:36:45 -0000	1.50
@@ -495,18 +495,25 @@
     # a new instance of this Resource is created for each client who views
     # it, so we can afford to track the request in the Resource.
     __implements__ = IHTMLLog,
+    asText = False
 
     def __init__(self, original):
         Resource.__init__(self)
         self.original = original
 
+    def getChild(self, path, request):
+        if path == "text":
+            self.asText = True
+            return self
+        return NoResource("bad pathname")
+
     def htmlHeader(self, request):
         title = "Log File contents"
         data = "<html>\n<head><title>" + title + "</title>\n"
         data += textlog_stylesheet
         data += "</head>\n"
         data += "<body vlink=\"#800080\">\n"
-        texturl = request.prePathURL() + "?text=1"
+        texturl = request.childLink("text")
         data += '<a href="%s">(view as text)</a><br />\n' % texturl
         data += "<pre>\n"
         return data
@@ -529,7 +536,7 @@
         return data
 
     def render_HEAD(self, request):
-        if request.args.has_key("text"):
+        if self.asText:
             request.setHeader("content-type", "text/plain")
         else:
             request.setHeader("content-type", "text/html")
@@ -563,9 +570,6 @@
 
     def render_GET(self, req):
         self.req = req
-        self.asText = False
-        if self.req.args.has_key("text"):
-            self.asText = True
 
         if self.asText:
             req.setHeader("content-type", "text/plain")





More information about the Commits mailing list