gmautil
index
/home/g2/users/dang/work/SourceForge/pyGMA/gmautil.py

Utility classes and functions for GMA Producer/Consumer

 
Modules
            
SocketServer
math
re
socket
struct
sys
time
types
urllib
urlparse

 
Classes
            
exceptions.Exception
Error
TOTException
KnowsParent
TimeoutTCPServer(SocketServer.TCPServer, KnowsParent)
SocketServer.TCPServer(SocketServer.BaseServer)
TimeoutTCPServer(SocketServer.TCPServer, KnowsParent)

 
class Error(exceptions.Exception)
       
  
__getitem__(...) from exceptions.Exception
__init__(...) from exceptions.Exception
__str__(...) from exceptions.Exception

 
class KnowsParent
      Interface for storage/retrieval of reference to parent class.
 
  
__init__(self, parent)
getParent(self)
setParent(self, new)

 
class TOTException(exceptions.Exception)
      Subclass of Exception for TimeoutTCPServer.
 
  
__getitem__(...) from exceptions.Exception
__init__(self, text)
__repr__ = __str__(self)
__str__(self)

 
class TimeoutTCPServer(SocketServer.TCPServer, KnowsParent)
      TCP SocketServer that starts in its own thread, and
can be joined and stopped mid-course, with a maximum delay
specified by the timeout.
Also, it can be directed to only serve a specific number
of requests before stopping (e.g.: 1).
 
  
__del__(self)
__init__(self, port, timeout, handler, max_requests=0, parent=None)
_abortServer(self)
_badArgs(self, port, timeout, handler)
_maxRequestsReached(self, n)
_signalStarted(self)
Signal that server thread has started
_startServer(self)
Start a server.
This never returns, so needs to be started in its own thread.
The caller should wait for the server_started.notify() before
proceeding (see __init__).
_waitStarted(self)
Wait for server thread signal
Pre: server_started lock has been acquire()d
_waitingForData(self, ready)
close(self)
close_request(self, request) from SocketServer.TCPServer
fileno(self) from SocketServer.TCPServer
finish_request(self, request, client_address) from SocketServer.BaseServer
getParent(self) from KnowsParent
get_request(self)
Get the request from the socket, with a timeout.
If the server is closed during the select or accept,
then shut down.
handle_error(self, request, client_address) from SocketServer.BaseServer
handle_request(self) from SocketServer.BaseServer
process_request(self, request, client_address) from SocketServer.BaseServer
serve_forever(self)
Handle one request at a time until _doomsday.
server_activate(self) from SocketServer.TCPServer
server_bind(self) from SocketServer.TCPServer
server_close(self)
Close the listening socket and join the thread.
setParent(self, new) from KnowsParent
verify_request(self, request, client_address) from SocketServer.BaseServer

 
Functions
            
select(...)
select(rlist, wlist, xlist[, timeout]) -> (rlist, wlist, xlist)
 
Wait until one or more file descriptors are ready for some kind of I/O.
The first three arguments are lists of file descriptors to be waited for:
rlist -- wait until ready for reading
wlist -- wait until ready for writing
xlist -- wait for an ``exceptional condition''
If only one kind of condition is required, pass [] for the other lists.
A file descriptor is either a socket or file object, or a small integer
gotten from a fileno() method call on one of those.
 
The optional 4th argument specifies a timeout in seconds; it may be
a floating point number to specify fractions of seconds.  If it is absent
or None, the call will never time out.
 
The return value is a tuple of three lists corresponding to the first three
arguments; each contains the subset of the corresponding file descriptors
that are ready.
 
*** IMPORTANT NOTICE ***
On Windows, only sockets are supported; on Unix, all file descriptors.

 
Data
             __file__ = './gmautil.pyc'
__name__ = 'gmautil'
__rcs_info__ = {'author': '$Author: dkgunter $', 'created': '1 June 2001', 'creator': 'Dan Gunter, dkgunter@lbl.gov', 'date': '$Date: 2001/07/13 22:25:23 $', 'module_name': '$RCSfile: gmautil.html,v $', 'project': 'pyGMA', 'rcs_id': '$Id: gmautil.html,v 1.1 2001/07/13 22:25:23 dkgunter Exp $', 'version': '$Revision: 1.1 $'}
mDebug = 0
mNLExpr = r'\s*([\w\-:._]+)=([\w\-:._]+|"[\w\-:._ \t]*")+'
mNLPattern = <SRE_Pattern object>