Table of Contents

Module: pb Twisted-0.19.0/twisted/spread/pb.py

Perspective Broker

\"This isn\'t a professional opinion, but it's probably got enough internet to kill you.\" --glyph

Introduction

This is a broker for proxies for and copies of objects. It provides a translucent interface layer to those proxies.

The protocol is not opaque, because it provides objects which represent the remote proxies and require no context (server references, IDs) to operate on.

It is not transparent because it does not attempt to make remote objects behave identically, or even similiarly, to local objects. Method calls are invoked asynchronously, and specific rules are applied when serializing arguments.

Imported modules   
import banana
import cStringIO
import copy
from flavors import Serializable, Referenceable, Root, ViewPoint, Viewable, Copyable, Cacheable, RemoteCopy, RemoteCache, RemoteCacheObserver, copyTags, setCopierForClass, setUnjellyableForClass, setFactoryForClass, setCopierForClassTree
from jelly import jelly, unjelly, globalSecurity
import string
import sys
import traceback
from twisted.cred import authorizer, service, perspective, identity
from twisted.internet import reactor
from twisted.persisted import styles
from twisted.protocols import protocol
from twisted.python import log, defer, failure
import types
Functions   
_cbLogInRespond
_cbLogInResponded
_cbRespondToChallenge
_connGotRoot
authIdentity
connect
failure2Copyable
getObjectAt
logIn
noOperation
printTraceback
print_excFullStack
  _cbLogInRespond 
_cbLogInRespond (
        (,
        d,
        client,
        service,
        password,
        perspectiveName,
        )

  _cbLogInResponded 
_cbLogInResponded (
        identity,
        d,
        client,
        serviceName,
        perspectiveName,
        )

  _cbRespondToChallenge 
_cbRespondToChallenge (
        (,
        password,
        d,
        )

  _connGotRoot 
_connGotRoot (
        root,
        d,
        client,
        serviceName,
        username,
        password,
        perspectiveName,
        )

  authIdentity 
authIdentity (
        authServRef,
        username,
        password,
        )

Return a Deferred which will do the challenge-response dance and return a remote Identity reference.

  connect 
connect (
        host,
        port,
        username,
        password,
        serviceName,
        perspectiveName=None,
        client=None,
        timeout=None,
        )

Connects and authenticates, then retrieves a PB service.

Required arguments: host -- the host the service is running on port -- the port on the host to connect to username -- the name you will be identified as to the authorizer password -- the password for this username serviceName -- name of the service to request

Optional (keyword) arguments: perspectiveName -- the name of the perspective to request, if different than the username client -- XXX the "reference" argument to perspective.Perspective.attached timeout -- see twisted.internet.tcp.Client

Returns:

A Deferred instance that gets a callback when the final Perspective is connected, and an errback when an error occurs at any stage of connecting.

  failure2Copyable 
failure2Copyable ( fail )

  getObjectAt 
getObjectAt (
        host,
        port,
        timeout=None,
        )

Establishes a PB connection and returns with a RemoteReference.

Arguments:

host: the host to connect to

port: the port number to connect to

timeout (optional): a value in milliseconds to wait before failing by default.

Returns:

A Deferred which will be passed a remote reference to the root object of a PB server.x

  logIn 
logIn (
        authServRef,
        client,
        service,
        username,
        password,
        perspectiveName=None,
        )

I return a Deferred which will be called back with a Perspective.

  noOperation 
noOperation ( *args,  *kw )

Do nothing.

Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...

  printTraceback 
printTraceback ( tb )

Print a traceback (string) to the standard log.

  print_excFullStack 
print_excFullStack ( file=None )

Print exception traceback with the full stack.

This is in contrast to traceback.print_exc which only prints the traceback between the frame where the error occoured and the frame where the exception was caught, but not the frames leading up to that one.

The need for this function arises from the fact that several PB classes have the peculiar habit of discarding exceptions with bareword "except:"s. This premature exception catching means tracebacks generated here don't tend to show what called upon the PB object.

Classes   
AsReferenceable

AsReferenceable: a reference directed towards another object.

AuthChallenger

XXX

AuthRoot

I provide AuthServs as root objects to Brokers for a BrokerFactory.

AuthServ

XXX

Broker

I am a broker for objects.

BrokerFactory

I am a server for object brokerage.

CopiedFailure
CopyableFailure

A RemoteCopy and Copyable version of failure.Failure for serialization.

Error

This error can be raised to generate known error conditions.

IdentityWrapper

I delegate most functionality to a identity.Identity.

Local

(internal) A reference to a local object.

Perspective

A perspective on a service.

ProtocolError

This error is raised when an invalid protocol statement is received.

RemoteMethod

This is a translucent reference to a remote message.

RemoteReference

This is a translucent reference to a remote object.

Service

A service for Perspective Broker.

_Detacher
_ObjectRetrieval

(Internal) Does callbacks for getObjectAt.

_RemoteCacheDummy

Ignore.


Table of Contents

This document was automatically generated on Sun Jul 14 19:53:20 2002 by HappyDoc version 2.0