Package cherrypy :: Package lib :: Module encoding
[hide private]
[frames] | no frames]

Module encoding

source code

Classes [hide private]
  ResponseEncoder
Functions [hide private]
 
decode(encoding=None, default_encoding='utf-8')
Replace or extend the list of charsets used to decode a request entity.
source code
 
compress(body, compress_level)
Compress 'body' at the given compress_level.
source code
 
decompress(body) source code
 
gzip(compress_level=5, mime_types=['text/html', 'text/plain'], debug=False)
Try to gzip the response body if Content-Type in mime_types.
source code
Variables [hide private]
  __package__ = 'cherrypy.lib'
Function Details [hide private]

decode(encoding=None, default_encoding='utf-8')

source code 
Replace or extend the list of charsets used to decode a request entity.

Either argument may be a single string or a list of strings.

encoding
    If not None, restricts the set of charsets attempted while decoding
    a request entity to the given set (even if a different charset is given in
    the Content-Type request header).

default_encoding
    Only in effect if the 'encoding' argument is not given.
    If given, the set of charsets attempted while decoding a request entity is
    *extended* with the given value(s).

gzip(compress_level=5, mime_types=['text/html', 'text/plain'], debug=False)

source code 
Try to gzip the response body if Content-Type in mime_types.

cherrypy.response.headers['Content-Type'] must be set to one of the
values in the mime_types arg before calling this function.

The provided list of mime-types must be of one of the following form:
    * type/subtype
    * type/*
    * type/*+subtype

No compression is performed if any of the following hold:
    * The client sends no Accept-Encoding request header
    * No 'gzip' or 'x-gzip' is present in the Accept-Encoding header
    * No 'gzip' or 'x-gzip' with a qvalue > 0 is present
    * The 'identity' value is given with a qvalue > 0.