Jack Moffitt pisze:
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.
twistd(1) starts logging automatically, giving you a command line option to redirect the logs to a file.
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.
tac files are standard Python files. twistd(1) is also a standard way to deploy Twisted applications. If you want the user just to run a file with Python, you will copy a lot of things that twistd(1) already does.
I'd rather them be able to type "tape" and not have to worry about twistd -ny some.tac.
$ echo "twistd -ny tape.tac" > tape; chmod +x ./tape; export PATH=.:$PATH
I use tac files a lot, but they don't make much sense for simple utilities.
Of course. That's why twistd(1) lets you start things right off the command line.
* 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: http://twistedmatrix.com/documents/current/api/twisted.web.resource.IResourc...
Ahh. You're using twisted.web . I thought you're using Nevow. Nevow's rend.Page http://starship.python.net/crew/mwh/nevowapi/nevow.rend.Page.html
* 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.
See above. -- m