Package SPyRO :: Module SPyRO
[hide private]
[frames] | no frames]

Module SPyRO

source code

Simple Python Remote Objects Implements Simple Remote Objects (attributes and methods).

Provides the complete suite: server and client services, and RemoteObject wrappers to objects.

Implement new formats are quite simple. Just create a class or module with the methods or functions loads and dumps and register your interface with the |registerFormat| function. Thread safe operation is responsibility of the new add-on.

Important Note: Since SPyRO |Server| is multithreaded, but |CommunicationCliente| had synchronous protocol, it will not be able to manage many request (every action over a object is a request) on the same connection. It is necessary use a |Client| object peer concurrent thread, in the best case, may be one or two are necessary or use |TClient| (uses a pool of |Client|'s transparentely).

Classes [hide private]
  RemoteException
  AttributeIsCallable
  TransportProtocolMixIn
Common methods in the ProtocolHTTP* server and clients
  ProtocolHTTPReader
Protocol used by clients, it runs under HTTP transmition layer
  ProtocolHTTPShared
An HTTP Server to manage SPyRO requests, attached to another HTTP server
  Request
Object to request to the remote object server
  Response
Objects to send as response at requests.
  BasicServer
The base of spyro's communication servers
  CommunicationServerShared
  CommunicationServer
Starts a standalone SPyRO Server
  ServerShare
  Server
Starts a standalone SPyRO Server
  CommClientMixIn
The mixin to CommunicationClient{,Threaded}
  CommunicationClientBase
A base class to any CommunicationServer client.
  CommunicationClient
A Client to CommunicationServer.
  Client
A Client to CommunicationServer.
  CommunicationClientThreaded
The thread safe CommunicationClient.
  TClient
The thread safe CommunicationClient.
  CallClient
Special Client thay always call methods, no attribute operations are allowed
  TCallClient
Special TClient to always call methods, no attribute operations
  FakeIterator
FakeIterator
  RemoteObject
Local representation of a RemoteObject.
Functions [hide private]
 
getrequest()
Returns the spyro's request dictionary that rules the current thread or spyro request.
source code
 
_setrequest(data) source code
 
_delrequest() source code
 
_set_booleans() source code
 
defaultoverture(httpreq, environment)
By default pickle is disabled, to enable you must overload 'overture' or set to None
source code
 
newRequest(objname, attrname, reqtype, auth) source code
 
newRequestSet(objname, attrname, value, local_server, auth)
Creates a new Request for a |setattr| operation, to set the attrname to value
source code
 
newRequestGet(objname, attrname, rettype, auth)
Creates a new Request for a |getattr| operation
source code
 
newRequestDel(objname, auth)
Creates a new Request for a DEL object operation
source code
 
newRequestBye()
Creates a new Request for a BYE object operation
source code
 
newRequestCall(objname, attrname, args, kwargs, rettype, local_server, auth, extra)
A SPyRO request, call mode |objname| Object name |attrname| The methodname |args| Positional arguments, tuple |kwargs| Keyword arguments, dictionary |rettype| The return type, SendByReference or SendByValue |local_server| If Request to call a remote method and exists port we call the method with the pass the arguments by reference the server receives the name or id in the remote peer (the caller) and a port to connect.
source code
 
ObjectWrapper_GuessType(xobject, xserver)
Function to wrap object guessing the more convenient type to send (send by reference or by value)
source code
 
ObjectWrapper_ByReference(xobject, xserver, xauthority=None)
Wrap objects to send objects to Reference
source code
 
ObjectWrapper_ByValue(xobject)
Wrap objects to send objects to Reference
source code
 
ObjectWrapper_Unpack(objarg) source code
 
ObjectWrapper_GetObject(objarg) source code
 
ObjectWrapper_GetType(objarg) source code
 
newResponse(errcode, retvalue, rettype)
Create and returns a server side response from the arguments
source code
 
default_socket_error_handler(comm, _socket, addr, error)
The default, fool, error handler in Client connections
source code
 
getobject(address, location, name, local_server=None, poolSize=0)
Can be used as a shortcut when only we need one object in address
source code
 
getconn(remoteobject)
Return the connection of the remote object
source code
 
getobjname(remoteobject)
Returns the name of the object
source code
Variables [hide private]
  __thread_data__ = {}
  warn = warn.Warn("SPyRO.SPyRO")
  sleep_min_sec = 0.05
  sleep_max_sec = 100.0
  SendByReference = 'REF'
  SendByValue = 'VAL'
  _HIBRID_SEND_VALUE_tuple = (<type 'str'>, <type 'NoneType'>, <...
  __doc__ = ...
  ORBFormats = {'XML': <bound method ORBFormats.fmtXML of {...}>...
Function Details [hide private]

getrequest()

source code 
Returns the spyro's request dictionary that rules the current thread or spyro request. If this thread is not ruled by an spyro request, it will raise a KeyError exception

defaultoverture(httpreq, environment)

source code 

By default pickle is disabled, to enable you must overload 'overture' or set to None

Any other prelude action must be done in this method. The overture is provided to control the execution before start it. The authorities (from policies) are checked when a protocol is up and loading. This method must be set to control access and tune settings before any protocol and authority.

newRequestCall(objname, attrname, args, kwargs, rettype, local_server, auth, extra)

source code 
A SPyRO request, call mode |objname| Object name |attrname| The methodname |args| Positional arguments, tuple |kwargs| Keyword arguments, dictionary |rettype| The return type, SendByReference or SendByValue |local_server| If Request to call a remote method and exists port we call the method with the pass the arguments by reference the server receives the name or id in the remote peer (the caller) and a port to connect. The IP address is obtained by the socket |auth| The authentication object |extra| Additional info to append to message, for example routed calls

Variables Details [hide private]

_HIBRID_SEND_VALUE_tuple

Value:
(<type 'str'>,
 <type 'NoneType'>,
 <type 'int'>,
 <type 'bool'>,
 <type 'long'>,
 <type 'float'>,
 <type 'unicode'>)

__doc__

Value:
"""
Simple Python Remote Objects
Implements Simple Remote Objects (attributes and methods).

Provides the complete suite: server and client services, and RemoteObj\
ect
wrappers to objects.

...

ORBFormats

Value:
{'XML': <bound method ORBFormats.fmtXML of {...}>, '': <bound method O\
RBFormats.fmtDEFAULT of {...}>, 'GUESS': <bound method ORBFormats.fmtG\
UESS of {...}>, 'XMLRPC': <bound method ORBFormats.fmtXMLRPC of {...}>\
, 'XMLGENERIC': <bound method ORBFormats.fmtXMLGENERIC of {...}>, 'WDD\
X': <bound method ORBFormats.fmtWDDX of {...}>, 'SOAP': <bound method \
ORBFormats.fmtZSI of {...}>, 'SOAPpy': <bound method ORBFormats.fmtSOA\
Ppy of {...}>, 'XMLRPC-Legacy': <bound method ORBFormats.fmtXMLRPCLega\
cy of {...}>, 'SOAPZSI': <bound method ORBFormats.fmtZSI of {...}>, 'P\
...