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

Module static

source code

Functions [hide private]
 
serve_file(path, content_type=None, disposition=None, name=None)
Set status, headers, and body in order to serve the given file.
source code
 
serve_download(path, name=None)
Serve 'path' as an application/x-download attachment.
source code
 
_attempt(filename, content_types) source code
 
staticdir(section, dir, root='', match='', content_types=None, index='')
Serve a static resource from the given (root +) dir.
source code
 
staticfile(filename, root=None, match='', content_types=None)
Serve a static resource from the given (root +) filename.
source code
Function Details [hide private]

serve_file(path, content_type=None, disposition=None, name=None)

source code 

Set status, headers, and body in order to serve the given file.

The Content-Type header will be set to the content_type arg, if provided. If not provided, the Content-Type will be guessed by its extension.

If disposition is not None, the Content-Disposition header will be set to "<disposition>; filename=<name>". If name is None, it will be set to the basename of path. If disposition is None, no Content-Disposition header will be written.