[Twisted-Python] twisted.net refactoring

Glyph Lefkowitz glyph at twistedmatrix.com
Tue Apr 17 04:15:42 EDT 2001


This is definitely the direction I want twisted.net to be going in.  Thank 
you for implmenting it (as well as the additional protocols!).

Have you started making the requisite changes in net.py as well?

On Monday 16 April 2001 16:07, you wrote:
> Hi!
> I've started to work on refactoring twisted.net for minimal dependancies.
> Currently, in the vein of "research project", what interests me is how
> layering of protocols in an event-oriented framework can be accomplished.
> Please have a look at http://moshez.org/protocols.tgz
> I've written tests for all the protocol handlers I wrote, and I'd
> be happy to work with anyone who wants to write tests for the irc client
> and telnet server.
>
> Basically, the idea is to turn low-level events (basically just handleData)
> into high level events (like handleRequest, for HTTP, at the other end
> of the spectrum). The idea is to reflect the layering of protocols (and
> only the layering of protocols -- read on) in the classes.
>
> So, inheritance happens when the spec references another spec -- e.g.,
> XML-RPC is defined to be over HTTP, so it would be correct to have
>
> class XMLRPCHandler(HTTPHandler):
>
>     def handleRequest(self, command, selector, version, request):
>         ...parse request into Python tuple...
>         result = self.handleMethod(params)
>         ....return HTTP response...
>
> But, on the other hand, HTTP does not say anything about TCP/IP, so
> HTTP should *not* be layered above any transport. This allows us to
> use SSL, SOCKS or files just as well.
>
> One big advantage I'm interested in is testability -- see the examples
> already there to get my point -- you can bombard your handler hard-coded
> strings and watch for the answers.

-- 
                      ______      __   __  _____  _     _
                     |  ____ |      \_/   |_____] |_____|
                     |_____| |_____  |    |       |     |
                     @ t w i s t e d m a t r i x  . c o m
                     http://twistedmatrix.com/users/glyph





More information about the Twisted-Python mailing list