[Twisted-web] some questions about twisted.web

Jack Moffitt jack at chesspark.com
Tue Apr 7 12:57:37 EDT 2009

> When you start your application:
>     from twisted.python import log
>     log.startLogging(sys.stdout)

Now I've just deluged the poor user with lots of factory start and
stops.  All I want is normal HTTP style logs.  Twisted's logging
infrastructure has its place, but it is not quite ready to produce
user friendly output for a simple utility.

> Or, even better, create an Application object and use twistd(1) to start
> your service. Using twistd(1), you have a choice to daemonize your process
> or not.

Great, now the user has to edit a tac file just to configure the
thing.  I'd rather them be able to type "tape" and not have to worry
about twistd -ny some.tac.  I use tac files a lot, but they don't make
much sense for simple utilities.  It sucks that it's either/or with
Twisted applications.

> These sessions helped to reinforce for me the need to repeat this frequently
> for our users: if Twisted is doing something which confuses you but seems
> wrong, please go ahead and file a bug on twistedmatrix.com.

This mailing list should be indexed by Google as well.  I do plan to
file the bugs we find here as well.

> * The only way to stick something in the tree at an arbitrary location
> seems to be to walk the tree to that spot, creating dummy locations as
> you go.
> Override locateChild

What is that?   I see no such function:
Not in IResource:

Not in the server.Site:

grep -r doesn't show it in the twisted/web or any child directories.
Not even in SVN trunk.

> I find it extremely weird coming from several other web
> frameworks.
> Twisted initially seems very different, no matter what framework you came
> from.

I grok Twisted just fine.  This may be my first post to twisted-web,
but I've been hacking on and around Twisted for some time.  Even
Apache doesn't work this way.  I can tell apache that my proxy is at
/some/url/over/here and it will work.  It will return 404s for the
intermediate URLs.  Because Resources only have immediate children and
paths are only dealt with in single element pieces, there doesn't seem
to be a way to do this in Twisted Web.  It feels weird that the tree
must be complete.  It feels weird that paths are dealt with in tiny

> * Related to the above, the handling of foo vs. foo/ is pretty
> confusing.  foo/ is considered the '' child of foo.  This is pretty
> yuck to me.  Unfortunately, I don't have any creative suggestions
> about how to do it better right now.
> addSlash = True

This does not exist in Resource or in server.Site.  What am I missing?
 It's not mentioned in the docs either.

I see that static.File has an addSlash method, but this doesn't seem
to be hooked up to anything.


More information about the Twisted-web mailing list