[Twisted-web] some questions about twisted.web

Christopher Armstrong radix at twistedmatrix.com
Tue Apr 7 17:27:13 EDT 2009

On Tue, Apr 7, 2009 at 5:08 PM, Jack Moffitt <jack at chesspark.com> wrote:
>> I really can't understand you. The way I'm reading your first sentence
>> in this paragraph is so silly that I must be misreading the intention.
>> Maybe the problem is that you don't understand what twistd plugins
>> really are. If you care, I recommend reading the URL that Michal
>> referred to earlier:
>> http://twistedmatrix.com/projects/core/documentation/howto/tap.html
> Thanks for the second nudge here.  The big note about how this is not
> the same as tap files cleared it up for me.
> So to get what I want, I'd write a plugin for Tape, then wrap that
> with some user friendly python to hide the non-essential command line
> options or the fact that I need twistd.
> It sounds like a reasonable first step to making this better would be
> to have some way to hook into twistd from the code side.  Perhaps this
> is already possible?

The twistd API is almost non-existent, unfortunately. However, you can
get a long way by doing something like this in your "main script":

from twisted.scripts.twistd import run
sys.argv[1:] = ["pluginname", "-whatever"]

It's decidedly a hack, but it works and relies only on public APIs, so
it's tolerable until we get a better API.

Christopher Armstrong

More information about the Twisted-web mailing list