[Twisted-Python] Creating a new selectable (for Pg async interface)

Bob Ippolito bob at redivi.com
Sun Dec 15 13:28:09 EST 2002


On Sunday, Dec 15, 2002, at 11:13 America/New_York, Gerhard Häring 
wrote:

> class PgAsyncConn(abstract.FileDescriptor):
>     def __init__(self):
>         abstract.FileDescriptor.__init__(self)
>
>         # PostgreSQL stuff
>         self.conn = libpq.PQconnectdb("host=gargamel dbname=gerhard")
>         self.fileno = self.conn.socket.fileno
>         self.startReading()


fileno needs to be a function

i.e.

self.fd = self.conn.socket.fileno
(after __init__)

def fileno(self):
   return self.fd

-bob




More information about the Twisted-Python mailing list