Module spiroserver :: Class SpiroSession
[show private | hide private]
[frames | no frames]

Class SpiroSession

BaseRequestHandler --+    
                     |    
  StreamRequestHandler --+
                         |
                        SpiroSession


Manages a single client session, over a TCP socket connection from the client.

When a client connects to the SPIRO server, the SpiroServer object creates an instance of this class, and invokes its handle method. See handle.

Note that if a client terminates its connection to the server, the server will destroy all current connections initiated by that client

Connection is persistent
Method Summary
  allocId(self)
Allocates a unique id
  dir(self)
List of symbols in interp dict
  do(self, stmts)
Executes one or more arbitarary statements.
  doimport(self, modname, attr)
Performs an import
  executeRequest(self, req)
Given a request (a dict), does what's needed
  getRequest(self)
Reads a client req - size data - a pickled dict
  handle(self)
Runs the whole client session, receiving commands from the client, executing them locally, and sending back results as appropriate
  pickleIfPossible(self, obj)
if object is non-mutable (hashable), try to pickle it and return the pickle.
  readbytes(self, n)
Guaranteed read of n bytes from client
  sendCallback(self, callbackId, args, kw)
Send a callback req to the client, and await result
  sendException(self, exc, reply, **kw)
Sends an exception back to client
  sendReply(self, reply, **kw)
Sends reply back to client.
    Inherited from StreamRequestHandler
  finish(self)
  setup(self)
    Inherited from BaseRequestHandler
  __init__(self, request, client_address, server)

Class Variable Summary
    Inherited from StreamRequestHandler
int rbufsize = -1                                                                    
int wbufsize = 0                                                                     

Method Details

allocId(self)

Allocates a unique id

dir(self)

List of symbols in interp dict

do(self, stmts)

Executes one or more arbitarary statements.

Arguments:
  • stmts - a string containing one or more newline-separated statements

doimport(self, modname, attr=None)

Performs an import

executeRequest(self, req)

Given a request (a dict), does what's needed

getRequest(self)

Reads a client req - size data - a pickled dict

handle(self)

Runs the whole client session, receiving commands from the client, executing them locally, and sending back results as appropriate
Overrides:
SocketServer.BaseRequestHandler.handle

pickleIfPossible(self, obj)

if object is non-mutable (hashable), try to pickle it and return the pickle.

Otherwise, return None

readbytes(self, n)

Guaranteed read of n bytes from client

sendCallback(self, callbackId, args, kw)

Send a callback req to the client, and await result

sendException(self, exc, reply=None, **kw)

Sends an exception back to client

Reply can be passed as a dict argument, or as keywords

sendReply(self, reply=None, **kw)

Sends reply back to client.

Reply can be passed as a dict argument, or as keywords

Generated by Epydoc 2.0 on Sun Apr 11 13:37:10 2004 http://epydoc.sf.net