[Twisted-Python] Re: serving dynamic on root and still serve static somehow

Christopher Armstrong radix at twistedmatrix.com
Mon Sep 29 14:46:14 EDT 2003

On Mon, Sep 29, 2003 at 07:24:15PM +0200, ccom at gmx.net wrote:
> Yeah, I noticed that when I set isLeaf = False in my root node my
> child nodes will get processed. At the same time my root will then
> serve a 404-No Such Resource, though.

With isLeaf=False, the root resource will _never_ have its render()
method called. That is because the request for the root resource is
always '/', not ''. (i.e., "GET / HTTP/1.1", not "GET  HTTP/1.1")

'/'.split('/') == [''], which means that getChild('', request) will be
called. Therefore, your root resource must respond to 
getChild('', request).

 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+     http://twistedmatrix.com/users/radix.twistd/

More information about the Twisted-Python mailing list