Table of Contents

Class: Perspective Twisted-0.17.4/twisted/spread/pb.py

A perspective on a service.

perspective, n. : The relationship of aspects of a subject to each other and to a whole: 'a perspective of history'; a need to view the problem in the proper perspective.

A service represents a collection of state, plus a collection of perspectives. Perspectives are the way that networked clients have a view onto an object, or collection of objects on the server.

Although you may have a service onto which there is only one perspective, the common case is that a Perspective will be analagous to (or the same as) a "user"; if you are creating a PB-enabled service, your User (or equivalent) class should subclass Perspective.

Initially, a peer requesting a perspective will receive only a RemoteReference to a Perspective. When a method is called on that RemoteReference, it will translate to a method on the remote perspective named perspective_methodname. (For more information on invoking methods on other objects, see ViewPoint.)

Base Classes   
perspective.Perspective
Methods   
perspectiveMessageReceived
  perspectiveMessageReceived 
perspectiveMessageReceived (
        self,
        broker,
        message,
        args,
        kw,
        )

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 Perspective are expected to implement methods of this naming convention.


Table of Contents

This document was automatically generated on Sat Apr 20 01:31:32 2002 by HappyDoc version 2.0