Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
MoinMoin.support.flup.server.fcgi_base.OutputStream Class Reference

List of all members.

Public Member Functions

def __init__
def write
def writelines
def flush
def close

Public Attributes

 dataWritten
 closed

Private Member Functions

def _write

Private Attributes

 _conn
 _req
 _type
 _buffered
 _bufList

Detailed Description

FastCGI output stream (FCGI_STDOUT/FCGI_STDERR). By default, calls to
write() or writelines() immediately result in Records being sent back
to the server. Buffering should be done in a higher level!

Definition at line 276 of file fcgi_base.py.


Constructor & Destructor Documentation

def MoinMoin.support.flup.server.fcgi_base.OutputStream.__init__ (   self,
  conn,
  req,
  type,
  buffered = False 
)

Definition at line 282 of file fcgi_base.py.

00282 
00283     def __init__(self, conn, req, type, buffered=False):
00284         self._conn = conn
00285         self._req = req
00286         self._type = type
00287         self._buffered = buffered
00288         self._bufList = [] # Used if buffered is True
00289         self.dataWritten = False
00290         self.closed = False


Member Function Documentation

def MoinMoin.support.flup.server.fcgi_base.OutputStream._write (   self,
  data 
) [private]

Definition at line 291 of file fcgi_base.py.

00291 
00292     def _write(self, data):
00293         length = len(data)
00294         while length:
00295             toWrite = min(length, self._req.server.maxwrite - FCGI_HEADER_LEN)
00296 
00297             rec = Record(self._type, self._req.requestId)
00298             rec.contentLength = toWrite
00299             rec.contentData = data[:toWrite]
00300             self._conn.writeRecord(rec)
00301 
00302             data = data[toWrite:]
00303             length -= toWrite

Here is the caller graph for this function:

Sends end-of-stream notification, if necessary.

Definition at line 331 of file fcgi_base.py.

00331 
00332     def close(self):
00333         """Sends end-of-stream notification, if necessary."""
00334         if not self.closed and self.dataWritten:
00335             self.flush()
00336             rec = Record(self._type, self._req.requestId)
00337             self._conn.writeRecord(rec)
00338             self.closed = True

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 323 of file fcgi_base.py.

00323 
00324     def flush(self):
00325         # Only need to flush if this OutputStream is actually buffered.
00326         if self._buffered:
00327             data = ''.join(self._bufList)
00328             self._bufList = []
00329             self._write(data)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 304 of file fcgi_base.py.

00304 
00305     def write(self, data):
00306         assert not self.closed
00307 
00308         if not data:
00309             return
00310 
00311         self.dataWritten = True
00312 
00313         if self._buffered:
00314             self._bufList.append(data)
00315         else:
00316             self._write(data)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 317 of file fcgi_base.py.

00317 
00318     def writelines(self, lines):
00319         assert not self.closed
00320 
00321         for line in lines:
00322             self.write(line)

Here is the call graph for this function:


Member Data Documentation

Definition at line 286 of file fcgi_base.py.

Definition at line 287 of file fcgi_base.py.

Definition at line 283 of file fcgi_base.py.

Definition at line 284 of file fcgi_base.py.

Definition at line 285 of file fcgi_base.py.

Definition at line 289 of file fcgi_base.py.

Definition at line 288 of file fcgi_base.py.


The documentation for this class was generated from the following file: