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

Module encoding

source code

Functions [hide private]
 
decode(encoding=None, default_encoding='utf-8')
Decode cherrypy.request.params from str to unicode objects.
source code
 
decode_params(encoding) source code
 
encode(encoding=None, errors='strict', text_only=True, add_charset=True) source code
 
encode_stream(encoding, errors='strict')
Encode a streaming response body.
source code
 
encode_string(encoding, errors='strict')
Encode a buffered response body.
source code
 
find_acceptable_charset(encoding=None, default_encoding='utf-8', errors='strict') source code
 
compress(body, compress_level)
Compress 'body' at the given compress_level.
source code
 
decompress(body) source code
 
gzip(compress_level=9, mime_types=['text/html', 'text/plain'])
Try to gzip the response body if Content-Type in mime_types.
source code
Variables [hide private]
  __package__ = 'cherrypy.lib'
Function Details [hide private]

encode_stream(encoding, errors='strict')

source code 

Encode a streaming response body.

Use a generator wrapper, and just pray it works as the stream is being written out.

gzip(compress_level=9, mime_types=['text/html', 'text/plain'])

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.

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.