Package twisted :: Package spread :: Module pb :: Class PBClientFactory
[frames | no frames]

Class PBClientFactory

  Factory --+    
            |    
ClientFactory --+
                |
               PBClientFactory

Known Subclasses:
ReconnectingPBClientFactory

Client factory for PB brokers.

As with all client factories, use with reactor.connectTCP/SSL/etc.. getPerspective and getRootObject can be called either before or after the connect.
Method Summary
  __init__(self)
  clientConnectionFailed(self, connector, reason)
Called when a connection has failed to connect.
  clientConnectionLost(self, connector, reason, reconnecting)
Reconnecting subclasses should call with reconnecting=1.
  clientConnectionMade(self, broker)
  disconnect(self)
If the factory is connected, close the connection.
  getPerspective(self, username, password, serviceName, perspectiveName, client)
Get perspective from remote PB server.
  getRootObject(self)
Get root object of remote PB server.
  login(self, credentials, client)
Login and get perspective from remote PB server.
    Inherited from ClientFactory
  startedConnecting(self, connector)
Called when a connection has been started.
    Inherited from Factory
  buildProtocol(self, addr)
Create an instance of a subclass of Protocol.
  doStart(self)
Make sure startFactory is called.
  doStop(self)
Make sure stopFactory is called.
  startFactory(self)
This will be called before I begin listening on a Port or Connector.
  stopFactory(self)
This will be called before I stop listening on all Ports/Connectors.

Class Variable Summary
classobj protocol = twisted.spread.pb.Broker
int unsafeTracebacks = 0                                                                     
    Inherited from Factory
Implements __implemented__ = <implementedBy twisted.internet.protoc...
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...
bool noisy = True
int numPorts = 0                                                                     

Method Details

clientConnectionFailed(self, connector, reason)

Called when a connection has failed to connect.

It may be useful to call connector.connect() - this will reconnect.
Parameters:
reason
           (type=twisted.python.failure.Failure)
Overrides:
twisted.internet.protocol.ClientFactory.clientConnectionFailed (inherited documentation)

clientConnectionLost(self, connector, reason, reconnecting=0)

Reconnecting subclasses should call with reconnecting=1.
Overrides:
twisted.internet.protocol.ClientFactory.clientConnectionLost

disconnect(self)

If the factory is connected, close the connection.

Note that if you set up the factory to reconnect, you will need to implement extra logic to prevent automatic reconnection after this is called.

getPerspective(self, username, password, serviceName, perspectiveName=None, client=None)

Get perspective from remote PB server.

New systems should use login() instead.
Returns:
Deferred of RemoteReference to the perspective.

getRootObject(self)

Get root object of remote PB server.
Returns:
Deferred of the root object.

login(self, credentials, client=None)

Login and get perspective from remote PB server.

Currently only credentials implementing twisted.cred.credentials.IUsernamePassword are supported.
Returns:
Deferred of RemoteReference to the perspective.

Class Variable Details

unsafeTracebacks

Type:
int
Value:
0                                                                     

Generated by Epydoc 2.1 on Sun Dec 10 22:04:44 2006 http://epydoc.sf.net