pyroxide.model.httpresponse (version 42 , 2007-03-18 22:41:06 -0700 (Sun, 18 Mar 2007) )
index
/usr/lib/python2.4/site-packages/pyroxide/model/httpresponse.py

The HTTP Response module.

 
Classes
       
HTTPResponse

 
class HTTPResponse
    An HTTP response.
 
Attributes:
    status     - 3 digit numeric return code
    Must use setStatus/getStatus for accessing the status.
    
    headers    - dictionary of header variables
    cookies    - a SimpleCookie object
    body       - the message body
    Must use getMessageBody/setMessageBody for accessing the message body
    
A minimal response only needs a status.
 
The default contentType is 'txt/html; charset=utf-8' and the default status
is 200.
 
If the body is set as a byte string then it is the programmer's
responsibility to encode the string appropriately for their character set
and this should match what they have set in the content type header.
 
If the body is set as a unicode string then the getMessageBody will encode
the string in the character set as defined by the content type header.
 
See RFC 2616 for HTTP/1.1 specifications.
 
  Methods defined here:
__init__(self, body=u'', contentType='text/html; charset=utf-8', status=200)
__repr__(self)
getMessageBody(self)
getStatus(self)
hasHeader(self, header)
Does the response contain the given header?
 
This is a case insensitive search because headers are case insensitive.
setMessageBody(self, body)
setStatus(self, status)

 
Functions
       
validate(response)
Loose validation of whether a response is an HTTPResponse object and has
minimal requirements.
 
No check is made of the content body because this may cause a template to
be rendered which can severely impact performance.

 
Data
        STATUS = {'ACCEPTED': 202, 'BAD_GATEWAY': 502, 'BAD_REQUEST': 400, 'CONFLICT': 409, 'CONTINUE': 100, 'CREATED': 201, 'EXPECTATION_FAILED': 417, 'FORBIDDEN': 403, 'FOUND': 302, 'GATEWAY_TIME_OUT': 504, ...}
__HeadURL__ = '$URL: http://pyroxide.org/svn/pyroxide/trunk/src/main/python/pyroxide/model/httpresponse.py $'
__Id__ = '$Id: httpresponse.py 42 2007-03-19 05:41:06Z kevin $'
__LastChangedBy__ = '$Author: kevin $'
__LastChangedDate__ = '$Date: 2007-03-18 22:41:06 -0700 (Sun, 18 Mar 2007) $'
__REPR__ = 'HTTPResponse:\n\tstatus=%s;\n\theaders=%s;\n\tcookies=%s\n\tbody=%s'
__Revision__ = '$Rev: 42 $'
__copyright__ = '(c) 2006 rootsmith Inc.'
__date__ = ' 2007-03-18 22:41:06 -0700 (Sun, 18 Mar 2007) '
__version__ = ' 42 '