summaryrefslogtreecommitdiff
path: root/cherrypy/tutorial
diff options
context:
space:
mode:
authorRobert Brewer <fumanchu@aminus.org>2006-04-21 20:44:17 +0000
committerRobert Brewer <fumanchu@aminus.org>2006-04-21 20:44:17 +0000
commit79c95fbf7e890f07676b9f71bac46c376b30875b (patch)
tree2ce205dc5043a7bccc5ff660485cca786568b2bc /cherrypy/tutorial
parente08b1fd8f28aebac7527235eaa66096452f9f6dd (diff)
downloadcherrypy-git-79c95fbf7e890f07676b9f71bac46c376b30875b.tar.gz
CP 3 initial checkin. Global filters have been replaced by request.hooks. Lots of renaming and reorg of modules.
Diffstat (limited to 'cherrypy/tutorial')
-rw-r--r--cherrypy/tutorial/tut09_files.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/cherrypy/tutorial/tut09_files.py b/cherrypy/tutorial/tut09_files.py
index 955e652d..64be177b 100644
--- a/cherrypy/tutorial/tut09_files.py
+++ b/cherrypy/tutorial/tut09_files.py
@@ -24,10 +24,10 @@ First, you can simply return a file-like object from your page handler.
CherryPy will read the file and serve it as the content (HTTP body)
of the response. However, that doesn't tell the client that
the response is a file to be saved, rather than displayed.
-Use cherrypy.lib.cptools.serveFile for that; it takes four
+Use cherrypy.lib.static.serve_file for that; it takes four
arguments:
-serveFile(path, contentType=None, disposition=None, name=None)
+serve_file(path, contentType=None, disposition=None, name=None)
Set "name" to the filename that you expect clients to use when they save
your file. Note that the "name" argument is ignored if you don't also
@@ -45,7 +45,7 @@ localDir = os.path.dirname(__file__)
absDir = os.path.join(os.getcwd(), localDir)
import cherrypy
-from cherrypy.lib import cptools
+from cherrypy.lib import static
class FileDemo(object):
@@ -86,7 +86,7 @@ class FileDemo(object):
def download(self):
path = os.path.join(absDir, "pdf_file.pdf")
- return cptools.serveFile(path, "application/x-download",
+ return static.serve_file(path, "application/x-download",
"attachment", os.path.basename(path))
download.exposed = True