[Twisted-Python] Subclassing static.File

Rick Morrison ram at forefront-tech.com
Mon Aug 4 20:10:22 EDT 2003

Hi All:

Warning: newbie alert:

Just beginning to look into Twisted, and I'm really impressed with the
breadth of the functionality here.
But, I'm having a bit of trouble getting my head fully around this thing.
Here's what I'm currently having trouble with.
Here's a simple program (that doesn't work) that subclasses the static.File

from twisted.internet import app
from twisted.web import static, server

class FileLogger(static.File):
    def __init__(self, path, defaultType="text/html", ignoredExts=(),
registry=None, allowExt=0):
        static.File(self, path, defaultType, ignoredExts, registry,

    def render(self, request):
        static.File.render(self, request)

root = FileLogger('/home/me/twtest')
a = app.Application('web')
a.listenTCP(8080, server.Site(root))

When I hit the site with a browser, the browser hangs. Interrupting the
twisted session causes the page to immediately appear in the browser.
...Comment out the override of the render() function, and everything works

What's going on?

More information about the Twisted-Python mailing list