4
4
mimetypes.types_map['.ico']='image/x-icon'
15
11
def serve_file(path, content_type=None, disposition=None, name=None, delete=False):
16
12
"""Set status, headers, and body in order to serve the given file.
18
14
The Content-Type header will be set to the content_type arg, if provided.
19
15
If not provided, the Content-Type will be guessed by the file extension
22
18
If disposition is not None, the Content-Disposition header will be set
23
19
to "<disposition>; filename=<name>". If name is None, it will be set
24
20
to the basename of path. If disposition is None, no Content-Disposition
28
24
response = cherrypy.response
30
26
# If path is relative, users should fix it by making path absolute.
31
27
# That is, CherryPy should not guess where the application root is.
32
28
# It certainly should *not* use cwd (since CP may be invoked from a