summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Brewer <fumanchu@aminus.org>2008-06-04 05:21:56 +0000
committerRobert Brewer <fumanchu@aminus.org>2008-06-04 05:21:56 +0000
commit729a94b3ea66e3224012bb2feb316c9d0e32d056 (patch)
treed800547a443d4e8df7db7874d8b7ae02ff31418d
parentd8a6b37f7d94a19314f48b309eb73ddf8ee4c688 (diff)
downloadcherrypy-729a94b3ea66e3224012bb2feb316c9d0e32d056.tar.gz
Docstring updates.
-rw-r--r--cherrypy/lib/static.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/cherrypy/lib/static.py b/cherrypy/lib/static.py
index dea2b746..e9df62f7 100644
--- a/cherrypy/lib/static.py
+++ b/cherrypy/lib/static.py
@@ -149,7 +149,21 @@ def _attempt(filename, content_types):
return False
def staticdir(section, dir, root="", match="", content_types=None, index=""):
- """Serve a static resource from the given (root +) dir."""
+ """Serve a static resource from the given (root +) dir.
+
+ If 'match' is given, request.path_info will be searched for the given
+ regular expression before attempting to serve static content.
+
+ If content_types is given, it should be a Python dictionary of
+ {file-extension: content-type} pairs, where 'file-extension' is
+ a string (e.g. "gif") and 'content-type' is the value to write
+ out in the Content-Type response header (e.g. "image/gif").
+
+ If 'index' is provided, it should be the (relative) name of a file to
+ serve for directory requests. For example, if the dir argument is
+ '/home/me', the Request-URI is 'myapp', and the index arg is
+ 'index.html', the file '/home/me/myapp/index.html' will be sought.
+ """
if match and not re.search(match, cherrypy.request.path_info):
return False
@@ -190,7 +204,16 @@ def staticdir(section, dir, root="", match="", content_types=None, index=""):
return handled
def staticfile(filename, root=None, match="", content_types=None):
- """Serve a static resource from the given (root +) filename."""
+ """Serve a static resource from the given (root +) filename.
+
+ If 'match' is given, request.path_info will be searched for the given
+ regular expression before attempting to serve static content.
+
+ If content_types is given, it should be a Python dictionary of
+ {file-extension: content-type} pairs, where 'file-extension' is
+ a string (e.g. "gif") and 'content-type' is the value to write
+ out in the Content-Type response header (e.g. "image/gif").
+ """
if match and not re.search(match, cherrypy.request.path_info):
return False