Package Pyblosxom :: Module pyblosxom :: Class Response
[show private | hide private]
[frames | no frames]

Type Response

object --+
         |
        Response


Response class to handle all output related tasks in one place.

This class is basically a wrapper arround a StringIO instance. It also provides methods for managing http headers.
Method Summary
  __init__(self, request)
Sets the Request object that leaded to this response.
  __iter__(self)
Can't copy the __iter__ method over from the StringIO instance cause iter looks for the method in the class instead of the instance.
  addHeader(self, *args)
Populates the HTTP header with lines of text.
dict getHeaders(self)
Returns the headers of this response.
  getStatus(self)
Returns the status code and message of this response.
  sendBody(self, out)
Send the response body to the given output stream.
  sendHeaders(self, out)
Send HTTP Headers to the given output stream.
  setStatus(self, status)
Sets the status code for this response.
  __copy_members(self)
Copies methods from the underlying output buffer to the response object.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

__init__(self, request)
(Constructor)

Sets the Request object that leaded to this response. Creates a StringIO that is used as a output buffer.
Parameters:
request - request object.
           (type=Request)
Overrides:
__builtin__.object.__init__

__iter__(self)

Can't copy the __iter__ method over from the StringIO instance cause iter looks for the method in the class instead of the instance. So can't do this with __copy_members, have to define it seperatly. See http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252151

addHeader(self, *args)

Populates the HTTP header with lines of text. Sets the status code on this response object if the given argument list containes a 'Status' header.
Parameters:
args - Paired list of headers
           (type=argument lists)
Raises:
ValueError - This happens when the parameters are not correct

getHeaders(self)

Returns the headers of this response.
Returns:
the HTTP response headers
           (type=dict)

getStatus(self)

Returns the status code and message of this response.
Returns:
str

sendBody(self, out)

Send the response body to the given output stream.
Parameters:
out - File like object
           (type=file)

sendHeaders(self, out)

Send HTTP Headers to the given output stream.
Parameters:
out - File like object
           (type=file)

setStatus(self, status)

Sets the status code for this response.
Parameters:
status - A status code and message like '200 OK'.
           (type=str)

__copy_members(self)

Copies methods from the underlying output buffer to the response object.

Generated by Epydoc 2.1 on Tue Feb 7 21:43:57 2006 http://epydoc.sf.net