[Twisted-Python] Allow static.Data to be at the root

Matthias Urlichs smurf at smurf.noris.de
Tue May 13 02:25:36 MDT 2003


Here's a small patch to allow a twisted.web.static.Data element at the
root of your web space.


diff -Nru a/twisted/web/static.py b/twisted/web/static.py
--- a/twisted/web/static.py	Tue May 13 10:22:32 2003
+++ b/twisted/web/static.py	Tue May 13 10:22:32 2003
@@ -59,6 +59,12 @@
             request.setHeader("content-length", len(self.data))
             return ''
         return self.data
+	
+    def getChild(self,path,request):
+        """Return myself if I am the root."""
+        if path == '' and request.path == "/":
+            return self
+        return resource.Resource.getChild(self,path,request)
 
 def addSlash(request):
     host = request.getHeader("host")
-- 
Matthias Urlichs  | {M:U} IT Consulting @ m-u-it.de  |  smurf at smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
-- 
"I believe in eight of the ten commandments; and I believe
 in going to church every Sunday unless there's a game on."
                  [Steve Martin]





More information about the Twisted-Python mailing list