__init__(self,
directory,
media_types=None,
unrecognised_media_type='application/data',
urlencoding='utf-8')
(Constructor)
Initialise the resource to serve files from the given
'directory'.
The optional 'media_types' dictionary can be used to map filename
extensions to media types, where extensions consist of the part of a
name after a "." character (such as "txt",
"html"), and where media types are the usual content
descriptions (such as "text/plain" and
"text/html").
If 'media_types' contains a mapping from None to a media type, then
this mapping is used when no extension is present on a requested
resource name.
Where no media type can be found for a resource, a predefined media
type is set which can be overridden by specifying a value for the
optional 'unrecognised_media_type' parameter.
The optional 'urlencoding' is used to decode "URL encoded"
character values in the request path, and overrides the default
encoding wherever possible.
-
|