[Twisted-web] some questions about twisted.web

Jack Moffitt jack at chesspark.com
Wed Apr 8 00:07:54 EDT 2009


> It seems like the need for this tool could have been obviated if "twistd
> web" had better support for composing plugins of its own.  I'd encourage you
> to look at 'twistd web --help' and see if maybe some future release can
> provide all the functionality you want.

Yes, I think that it would be able to do the same things.  The only
unknown is whether it would be easy to use.  I think if you added an
rc-file type thing for the web plugin, it would work quite nicely.
The more I think about it, the more I like it.

This turned into four bugs:

* #3752 to add the composable command line options
* #3753 to add the overlay resource infrastructure
* #3755 to add a proxy/reverse proxy option
* #3756 to add simple configuration files

If twistd web and twisted.web had those four things, it would totally
rock my world and there would not be a need for Tape.

> HTTPFactory should take a FilePath-like object (not a file-like object,
> since it may need to control when the log is opened and closed.

#3757

> _openLogFile is specifically documented as being for overriding in
> subclasses, yet it's private.  That doesn't make much sense.  Luckily the
> interface is broken anyway, so when we switch over to using a FilePath we
> can switch.

#3758

> While we're at it, twisted.python.logfile should really be updated to use
> FilePath as well, rather than direct os.path operations.

#3759

> The CLF-formatting logic really ought to be separated from the code that
> decides to actually write it to a file.  Off the top of my head it really
> seems like this should be a method on Request, but a free function would be
> fine too.

#3760

> In addition, there's this bug:
>
>   http://twistedmatrix.com/trac/ticket/75
>
> which is maybe too vague to actually be actionable, but I think the idea was
> to publish Request objects with a custom format string via
> twisted.python.log.

I updated #75 to point to the other 4 bugs.

>> * log() never gets called when a ReverseProxyResource is used.  It
>> appears as though request.finish() is never called, though I wasn't
>> able to fully track this down.  I find this behavior very odd.
>
> This one's an existing bug:
>
>   http://twistedmatrix.com/trac/ticket/2677
>
> Please feel free to attach commentary.

Done.

>  * In the long term, static.File really ought to compose in a FilePath, not
> inherit from it.  I don't know if it's possible to salvage static.File in
> its current state; I think we need a new static-content class that generally
> works the right way.

I'm not sure I'm the best person to write this bug.  Perhaps you could
do a quick brain dump into a ticket so it doesn't get lost.

>  * The parameters to __init__ should obviously be documented.

#3761

>  * createSimilarFile should be documented.

#3762

> In Nevow and web2, locateChild allows you to consume multiple segments at
> once.  The plan has always been to port these to twisted.web, but I can't
> find a ticket for that plan.

#3763

>> * ReverseProxyResource returns nothing if you don't give it a '/' at
>> the end.  I had to work around this by doing a redirect in the
>> subclass and then returning a new ReverseProxyResource when the ''
>> child is accessed.  It seems that if ReverseProxyResource's path is
>> '', it just keels over with no error.
>
> This could do with a bit more detail (mostly about what "keels over" means),
> but certainly sounds like a valid bug.

Fair enough.  The server literally hangs up the connection without
returning any response.

#3764

Thanks for your help; it was certainly useful to help me file better reports.

jack.



More information about the Twisted-web mailing list