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, 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 tcp
from twisted.persisted import styles
from twisted.protocols import protocol
from twisted.python import log, defer, failure
import types
|
Functions
|
|
|
|
_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.
|
|
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
|
|
|
|