Package flumotion :: Package twisted :: Module pb :: Class Avatar
[hide private]

Class Avatar

source code

twisted.spread.pb.Avatar --+
                           |
 extern.log.log.Loggable --+
                           |
                          Avatar
Known Subclasses:

Instance Methods [hide private]
 
__init__(self, avatarId) source code
 
perspectiveMessageReceived(self, broker, message, args, kwargs)
This method is called when a network message is received.
source code
 
perspectiveMessageReceivedUnserialised(self, broker, message, args, kwargs) source code
 
setMind(self, mind)
Tell the avatar that the given mind has been attached.
source code
 
mindCallRemoteLogging(self, level, stackDepth, name, *args, **kwargs)
Call the given remote method, and log calling and returning nicely.
source code
 
mindCallRemote(self, name, *args, **kwargs)
Call the given remote method, and log calling and returning nicely.
source code
 
disconnect(self)
Disconnect the remote PB client.
source code

Inherited from twisted.spread.pb.Avatar: __providedBy__

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure, writeMarker

Class Variables [hide private]
  logCategory = 'avatar'
Implementors can provide a category to log their messages under.
str remoteLogName = 'remote'
name to use to log the other side of the connection

Inherited from twisted.spread.pb.Avatar: __implemented__, __provides__

Method Details [hide private]

perspectiveMessageReceived(self, broker, message, args, kwargs)

source code 

This method is called when a network message is received.

I will call:

 |  self.perspective_%(message)s(*broker.unserialize(args),
 |                               **broker.unserialize(kw))

to handle the method; subclasses of Avatar are expected to implement methods of this naming convention.

Overrides: twisted.spread.pb.Avatar.perspectiveMessageReceived
(inherited documentation)

setMind(self, mind)

source code 

Tell the avatar that the given mind has been attached. This gives the avatar a way to call remotely to the client that requested this avatar.

It is best to call setMind() from within the avatar's __init__ method. Some old code still does this via a callLater, however.

Parameters:
  • mind (twisted.spread.pb.RemoteReference)

mindCallRemoteLogging(self, level, stackDepth, name, *args, **kwargs)

source code 

Call the given remote method, and log calling and returning nicely.

Parameters:
  • level (int) - the level we should log at (log.DEBUG, log.INFO, etc)
  • stackDepth (non-positive int) - the number of stack frames to go back to get file and line information, negative or zero.
  • name (str) - name of the remote method

mindCallRemote(self, name, *args, **kwargs)

source code 

Call the given remote method, and log calling and returning nicely.

Parameters:
  • name (str) - name of the remote method

disconnect(self)

source code 

Disconnect the remote PB client. If we are already disconnected, do nothing.