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

Class BasicServer

source code

Known Subclasses:
CommunicationServer, CommunicationServerShared

The base of spyro's communication servers

Instance Methods [hide private]
 
__init__(self, address=None, location='/spyro?XMLRPC', priorities=None, defaultFormat=None, transportProtocol=<class SPyRO.SPyRO.ProtocolHTTPShared at 0x852da1c>, objectpool=None, overture=<function defaultoverture at 0x85326bc>)
|address| The address where the Server is listening |location| Location or path in the web server |priorities| Priorities of the protocols |defaultFormat| The default message format where none is specified |transportProtocol| The class to manage the transport layer |objectpool| The object pool manager , if None then a new SeverObjectPool instance is used
source code
 
__getstate__(self)
To pickle functions
source code
 
regconn(self, conn)
Register a client connection
source code
 
delconn(self, conn)
Removes a client connection
source code
 
__setitem__(self, k, v)
Register an object.
source code
 
set(self, k, v)
Register an object |v| with the ID |k|.
source code
 
close(self)
Close server
source code
 
getcomm(self, local_server)
Returns the CommunicationClient associated to the address that made the |request| through the |serv|
source code
 
getargument(self, comm, arg)
Get the argument asociated to |arg| using the |comm| It manages references and values
source code
 
handlecall(self, obj, atr, objname, methodname, args, kwargs, local_server)
handles the execution of methods.
source code
 
can_del(self, authobj, req) source code
 
can_set(self, authobj, req) source code
 
can_follow_objname(self, authobj, req) source code
 
can_get(self, authobj, req) source code
 
can_call(self, authobj, req) source code
 
can_register(self, authobj, req) source code
 
handle(self, rfile, wfile, environment, httprequest, overture=None, request_rewrite=None)
Handles an spyro request reading the request from rfile, using the broker specified in environment['QUERY_STRING'] It writes data using wfile and the broker.
source code
 
handle_request(self, *args, **kwargs) source code
 
_handle_request(self, objname, attrname, args=(), kwargs={}, auth=None, extra=None, local_server=None, reqtype='CALL', rettype='VAL', value=None, req=None) source code
Method Details [hide private]

set(self, k, v)

source code 
Register an object |v| with the ID |k|. Use |setobj| instead

handlecall(self, obj, atr, objname, methodname, args, kwargs, local_server)

source code 

handles the execution of methods. called by handle. If the object has the attribute __spyro__ it must be an object with the |__contains__| method and every element is a method that must be handled by pass (call methods with the request method as the first argument, other arguments are passed as normal)

If the object has the attribute '__spyro_formats__' it must be a dictionary (object with the __getitem__ method) of { methodname: argumentformats }

Where |methodname| must be the name of methods where the arguments need to be checked |argumentformats| is the format as listed in the SPyRO.args module

handle(self, rfile, wfile, environment, httprequest, overture=None, request_rewrite=None)

source code 
Handles an spyro request reading the request from rfile, using the broker specified in environment['QUERY_STRING']
It writes data using wfile and the broker.
  |rfile| Read file
  |wfile| Write file
  |environment| Environment of the Request
  |httprequest| http request object
Optional arguments:
  |overture| Overture to be executed before anything. If overture throws an exception
  solve_request will not be executed. Prototype
  overture(httprequest,environment)
  |request_rewrite| If it's different of None it will be executed after the read of the
  request and the generated dictionary will be sent and perhaps modified.
     Prototype
     request_rewrite(requestdict,httprequest,environment)