Table of Contents

Class: HTTPResponse Zope-2.2.1-src/lib/python/ZPublisher/HTTPResponse.py

Base Classes   
BaseResponse
Methods   
__init__
__str__
_cookie_list
_error_html
_html
_traceback
_unauthorized
addHeader
appendCookie
appendHeader
badRequestError
debugError
exception
expireCookie
format_exception
insertBase
isHTML
notFoundError
quoteHTML
redirect
retry
setBase
setBody
setCookie
setHeader
setStatus
unauthorized
write
  __init__ 
__init__ (
        self,
        body='',
        status=200,
        headers=None,
        stdout=sys.stdout,
        stderr=sys.stderr,
        )

Creates a new response. In effect, the constructor calls "self.setBody(body); self.setStatus(status); for name in headers.keys(): self.setHeader(name, headers[name])"

  __str__ 
__str__ ( self,  html_search=regex.compile( '', regex.casefold ) )

  _cookie_list 
_cookie_list ( self )

  _error_html 
_error_html (
        self,
        title,
        body,
        )

  _html 
_html (
        self,
        title,
        body,
        )

  _traceback 
_traceback (
        self,
        t,
        v,
        tb,
        )

  _unauthorized 
_unauthorized ( self )

  addHeader 
addHeader (
        self,
        name,
        value,
        )

Set a new HTTP return header with the given value, while retaining any previously set headers with the same name.

  appendCookie 
appendCookie (
        self,
        name,
        value,
        )

Returns an HTTP header that sets a cookie on cookie-enabled browsers with a key "name" and value "value". If a value for the cookie has previously been set in the response object, the new value is appended to the old one separated by a colon.

  appendHeader 
appendHeader (
        self,
        name,
        value,
        delimiter=',',
        )

Append a value to a cookie

Sets an HTTP return header "name" with value "value", appending it following a comma if there was a previous value set for the header.

  badRequestError 
badRequestError ( self,  name )

Exceptions   
'BadRequest'
'InternalError'
  debugError 
debugError ( self,  entry )

Exceptions   
'NotFound'
  exception 
exception (
        self,
        fatal=0,
        info=None,
        absuri_match=regex.compile( "^" "\(/\|\([a-zA-Z0-9+.-]+:\)\)" "[^\000- \"\\#<>]*" "\\(#[^\000- \"\\#<>]*\\)?" "$" ),
        tag_search=regex.compile( '[a-zA-Z]>' ),
        abort=1,
        )

  expireCookie 
expireCookie (
        self,
        name,
        **kw,
        )

Cause an HTTP cookie to be removed from the browser

The response will include an HTTP header that will remove the cookie corresponding to "name" on the client, if one exists. This is accomplished by sending a new cookie with an expiration date that has already passed. Note that some clients require a path to be specified - this path must exactly match the path given when creating the cookie. The path can be specified as a keyword argument.

  format_exception 
format_exception (
        self,
        etype,
        value,
        tb,
        limit=None,
        )

  insertBase 
insertBase ( self,  base_re_search=regex.compile( '\(]+>\)', regex.casefold ) )

  isHTML 
isHTML ( self,  str )

  notFoundError 
notFoundError ( self,  entry='who knows!' )

Exceptions   
'NotFound'
  quoteHTML 
quoteHTML (
        self,
        text,
        subs={ '&' : '&', "<" : '<', ">" : '>', '\"' : '"' },
        )

  redirect 
redirect (
        self,
        location,
        status=302,
        lock=0,
        )

Cause a redirection without raising an error

  retry 
retry ( self )

Return a response object to be used in a retry attempt

  setBase 
setBase ( self,  base )

Set the base URL for the returned document.

  setBody 
setBody (
        self,
        body,
        title='',
        is_error=0,
        bogus_str_search=regex.compile( " [a-fA-F0-9]+>$" ),
        )

Set the body of the response

Sets the return body equal to the (string) argument "body". Also updates the "content-length" return header.

You can also specify a title, in which case the title and body will be wrapped up in html, head, title, and body tags.

If the body is a 2-element tuple, then it will be treated as (title,body)

If is_error is true then the HTML will be formatted as a Zope error message instead of a generic HTML page.

  setCookie 
setCookie (
        self,
        name,
        value,
        **kw,
        )

Set an HTTP cookie on the browser

The response will include an HTTP header that sets a cookie on cookie-enabled browsers with a key "name" and value "value". This overwrites any previously set value for the cookie in the Response object.

  setHeader 
setHeader (
        self,
        name,
        value,
        literal=0,
        )

Sets an HTTP return header "name" with value "value", clearing the previous value set for the header, if one exists. If the literal flag is true, the case of the header name is preserved, otherwise word-capitalization will be performed on the header name on output.

  setStatus 
setStatus (
        self,
        status,
        reason=None,
        )

Sets the HTTP status code of the response; the argument may either be an integer or a string from { OK, Created, Accepted, NoContent, MovedPermanently, MovedTemporarily, NotModified, BadRequest, Unauthorized, Forbidden, NotFound, InternalError, NotImplemented, BadGateway, ServiceUnavailable } that will be converted to the correct integer value.

  unauthorized 
unauthorized ( self )

Exceptions   
'Unauthorized'
  write 
write ( self,  data )

Return data as a stream

HTML data may be returned using a stream-oriented interface. This allows the browser to display partial results while computation of a response to proceed.

The published object should first set any output headers or cookies on the response object.

Note that published objects must not generate any errors after beginning stream-oriented output.


Table of Contents

This document was automatically generated on Mon Sep 4 07:33:06 2000 by HappyDoc version r0_6