[Twisted-web] Web2 and Half-Baked Reinvention of Wheels

David Reid dreid at dreid.org
Mon Jul 2 23:06:50 EDT 2007

On Jul 2, 2007, at 3:21 PM, Ed Suominen wrote:

> I have been debugging an odd problem that apparently is arising in
> web2.stream.FileStream. One thing I noticed while poring over the  
> source
> is that its read() method will try to instantiate SendfileBuffer if  
> you
> try to use its sendfile option. However, there's no reference To  
> such a
> class anywhere in the module or anywhere else in the Twisted source
> tree, for that matter. I understand that sendfile isn't supported, but
> it's horrible coding practice to let that just sit there in the  
> source.

There is a bug, please feel free to contribute a patch.  For a while  
now web2 has been kind of a solitary effort, and I just don't have  
the energy right now, but I will gladly review and apply a patch.

> As requested by Dialtone, and to borrow liberally from what he  
> wrote in
> an IRC chat with me today, web2.stream code is pretty badly tested and
> someone should do something about it. (I would also add that it is
> pretty badly documented, but that problem is widespread in Twisted's
> source, despite my ranting about it for years and offering bounties  
> for
> people to contribute docstrings.)

It is conceptually pretty bad, and counter to existing abstractions  
in Twisted.  I believe there is a bug about this, and even a branch  
that foom started, I do not know the status of this branch, nor the  
quality of the code that lies within it.  Feel free to review the  
branch, and post your findings in the associated ticket.

> Dialtone says that there are numerous other problems about streams. He
> says, and I wholeheartedly agree, that they are mostly a substitution
> for something that already exists in twisted, namely Producer/ 
> Consumer.
> (Please guys, stop chasing butterflies and direct your considerable
> talents toward improving what already works!) Dialtone says that glyph
> once wrote a replacement for the CompundStream using Producer/Consumer
> paradigm; instead of streams, we could use functions that combine
> different producers or consumers.

Right, that would be awesome and I fully support completely replacing  
streams with something based on the more traditional Producer/ 
Consumer model.

> I can't believe that the world's greatest networking platform *still*
> doesn't have an adequately supported HTTP server!

I'm sorry.  Despite much interest in web programming (in the python  
community,) there is a definite lack of interest in writing a proper  
HTTP server.  I really do love working on web2, and I'm sorry I  
haven't been able to give it the attention it deserves, but such is  
life.  I would welcome any contribution you're willing to make  
(though I am probably unable to directly accept a financial  


More information about the Twisted-web mailing list