[Twisted-Python] Re: [Zope3-dev] twisted zope

Phillip J. Eby pje at telecommunity.com
Mon Jul 28 13:25:54 EDT 2003

At 11:26 AM 7/28/03 -0400, Shane Hathaway wrote:
>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 

And there's yet another possible approach...  Have Zope depend on specific 
I*Reactor interfaces in place of asyncore, but don't necessarily depend on 
Twisted itself.  I'm not sure if this meets the intended goals for 
Zope/Twisted integration, but it's a useful first step.  If this is useful, 
PEAK has an "UntwistedReactor" class that implements a useful subset of the 
Twisted reactor interfaces, enough to be able to have a select loop and 
scheduled callbacks.  It's ZPL/PSF licensed, so you can steal it fair and 
square.  So, as long as the existing Zope 3 server code just expects to be 
woken up by asyncore for reads and writes, it should be pretty adaptable to 
the reactor interface, at which point it could be hooked into Twisted or 
into a Zope 3 mini-reactor.

More information about the Twisted-Python mailing list