[Zope3-dev] twisted zope

Shane Hathaway shane@zope.com
Mon, 28 Jul 2003 11:26:15 -0400


Gary Poster wrote:
> As to the request parsing, I like Twisted's design a lot.  My impression 
> is that if you used it, rather than Zope's request parsing, you would be 
> in for a lot more work, but that work would probably end up being a big 
> eventual win in clarity and simplicity.  If I were doing it, I'd punt 
> and stick with Zope's, with a regretful glance backward.  If you have 
> the gas to go up the mountain, though, I betcha the view's worth it. :-)

May I suggest a different approach?

Zope 3's HTTP request parsing is superior to Twisted's because it can 
more easily handle complex features of HTTP like pipelining.  However, 
Twisted's core is a better-executed implementation of the same idea 
behind asyncore.  Therefore, this is how I'd like to see the integration 
work:

- Enhance Twisted's HTTP server with notions taken from Zope 3's HTTP 
server.  The most important notion is that there is a request object 
that does nothing but receive the request data.  Once the entire request 
is received, the request is used to construct an HTTP transaction; at 
that time the request is considered immutable.  Also, the generic 
memory/disk buffer concept could be a big win for Twisted.

- Rename Zope 3's HTTPTask to HTTPTransaction.  Create IHTTPTransaction. 
  (It might become part of Twisted instead of Zope.)

- Add only specific modules of Twisted to the Zope 3 source, such as 
twisted.internet (I think that's its name).  Straighten out the 
licensing first.

- Connect Twisted's updated HTTP server with zope.publisher.  Dump use 
of asyncore altogether--maintaining that is unnecessary work.

- Connect Twisted's FTP server with zope.publisher.  Then you can merge 
the Zope branch.

I feel like I could do this with two or three days of work, but I 
probably shouldn't. ;-)  I'd really like to see this done, though.

Shane