WebKit.ASStreamOut | index /usr/local/share/webware/WebKit/ASStreamOut.py

`This module defines a class for handling writing reponses.`

Modules

``

exceptions | types |  |

Classes

``

ASStreamOut
exceptions.Exception
  InvalidCommandSequence

class ASStreamOut

``

`This is a response stream to the client.
The key attributes of this class are:
`_autoCommit`:
if True (1), the stream will automatically start sending data
once it has accumulated `_bufferSize` data. This means that
it will ask the response to commit itself, without developer
interaction.
`_bufferSize`:
The size of the data buffer. This is only used when autocommit
is true (1). If not using autocommit, the whole response is
buffered and sent in one shot when the servlet is done.
`flush()`:
Send the accumulated response data now. Will ask the `Response`
to commit if it hasn't already done so.
`

Methods defined here:

__init__(self)

autoCommit(self, val=0)
  `Get/Set the value of _autoCommit.`

buffer(self)
  `Return accumulated data which has not yet been flushed.
  We want to be able to get at this data without having to call flush
  first, so that we can (for example) integrate automatic HTML validation.`

bufferSize(self, size=8192)
  `Return the buffer size and set a new size if one is provided.`

clear(self)
  `Try to clear any accumulated response data.
  Will fail if the response is already sommitted.`

close(self)
  `Close this buffer. No more data may be sent.`

closed(self)
  `Check whether we are closed to new data.`

commit(self, autoCommit=1)
  `Called by the Response to tell us to go.
  If `_autoCommit` is True, then we will be placed into autoCommit mode.`

committed(self)
  `Are we committed?`

flush(self)
  `Flush stream.
  Send available data as soon as possible, i.e. *now*.
  Returns True if we are ready to send, otherwise False (i.e.,
  if the buffer is full enough).`

needCommit(self)
  `Request for commitment.
  Called by the `HTTPResponse` instance that is using this instance
  to ask if the response needs to be prepared to be delivered.
  The response should then commit it's headers, etc.`

pop(self, count)
  `Remove count bytes from the front of the buffer.`

prepend(self, charstr)
  `Add the attached string to front of the response buffer.
  Invalid if we are already committed.`

size(self)
  `Return the current size of the data held here.`

write(self, charstr)
  `Write a string to the buffer.`

class InvalidCommandSequence(exceptions.Exception)

``

Methods inherited from exceptions.Exception:

__getitem__(...)

__init__(...)

__str__(...)

Data
`` |  | debug = 0