On Apr 8, 2013, at 3:47 PM, Laurens Van Houtven <[email protected]> wrote:

> On Apr 8, 2013 9:44 PM, "Phil Budne" <[email protected]> wrote:
> > As a quick crock, I made my transport a subclass of
> > twisted.internet.tcp.Server, and got away with it, but I'd like to do
> > the right thing.
> >
> > I'd be delighted to find out that mixins exist that would solve my
> > problem, but I'd be happy to know what interfaces I need to implement,
> > or even better where I find find documentation on how to implement a
> > new "transport", especially one that isn't file-descriptor based.
> 
> Are you familiar with interfaces? ITransport sounds like what you want.
> 
> 

Saying that ITransport is sufficient is unfortunately a bit simplistic.  I am 
not sure about our HTTP server, but many protocols rely on other interfaces 
provided by Server, including:

>>> from twisted.internet.tcp import Server
>>> from zope.interface import implementedBy
>>> from pprint import pprint
>>> from twisted.python.reflect import qual
>>> pprint([qual(x) for x in implementedBy(Server)])
['twisted.internet.interfaces.ITCPTransport',
 'twisted.internet.interfaces.ISystemHandle',
 'twisted.internet.interfaces.ITLSTransport',
 'twisted.internet.interfaces.IPushProducer',
 'twisted.internet.interfaces.IReadWriteDescriptor',
 'twisted.internet.interfaces.IConsumer',
 'twisted.internet.interfaces.ITransport',
 'twisted.internet.interfaces.IHalfCloseableDescriptor',
 'twisted.internet.interfaces.ILoggingContext']

It might be useful to note the possible presence of some of these in the 
documentation for servers and clients.

-glyph

_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to