[Buildbot-commits] buildbot/buildbot/status/web base.py,1.10,1.11

Brian Warner warner at users.sourceforge.net
Wed Sep 26 09:41:13 UTC 2007


Update of /cvsroot/buildbot/buildbot/buildbot/status/web
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26064/buildbot/status/web

Modified Files:
	base.py 
Log Message:
[project @ web/base.py: fix addSlash to emit relative URLs]

Original author: warner at lothar.com
Date: 2007-09-26 09:40:03+00:00

Index: base.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/base.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- base.py	25 Sep 2007 22:50:40 -0000	1.10
+++ base.py	26 Sep 2007 09:41:11 -0000	1.11
@@ -1,4 +1,5 @@
 
+import urlparse
 from zope.interface import Interface
 from twisted.web import html, resource
 from buildbot.status import builder
@@ -142,7 +143,15 @@
 
     def render(self, request):
         if self.addSlash and request.prepath[-1] != '':
-            request.redirect(request.URLPath().child(''))
+            # this is intended to behave like request.URLPath().child('')
+            # but we need a relative URL, since we might be living behind a
+            # reverse proxy
+            url = request.prePathURL()
+            scheme, netloc, path, query, fragment = urlparse.urlsplit(url)
+            new_url = request.prepath[-1] + "/"
+            if query:
+                new_url += "?" + query
+            request.redirect(new_url)
             return ''
 
         data = self.content(request)





More information about the Commits mailing list