summaryrefslogtreecommitdiff
path: root/cherrypy/tutorial/tut07_sessions.py
diff options
context:
space:
mode:
Diffstat (limited to 'cherrypy/tutorial/tut07_sessions.py')
-rw-r--r--cherrypy/tutorial/tut07_sessions.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/cherrypy/tutorial/tut07_sessions.py b/cherrypy/tutorial/tut07_sessions.py
index 62efa440..204322b5 100644
--- a/cherrypy/tutorial/tut07_sessions.py
+++ b/cherrypy/tutorial/tut07_sessions.py
@@ -8,6 +8,8 @@ any kind of object into that dictionary; otherwise, you are limited to
objects that can be pickled.
"""
+import os.path
+
import cherrypy
@@ -15,6 +17,7 @@ class HitCounter:
_cp_config = {'tools.sessions.on': True}
+ @cherrypy.expose
def index(self):
# Increase the silly hit counter
count = cherrypy.session.get('count', 0) + 1
@@ -27,10 +30,8 @@ class HitCounter:
During your current session, you've viewed this
page %s times! Your life is a patio of fun!
''' % count
- index.exposed = True
-import os.path
tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf')
if __name__ == '__main__':
@@ -38,6 +39,3 @@ if __name__ == '__main__':
# to objects, so we need to mount a request handler root. A request
# to '/' will be mapped to HelloWorld().index().
cherrypy.quickstart(HitCounter(), config=tutconf)
-else:
- # This branch is for the test suite; you can ignore it.
- cherrypy.tree.mount(HitCounter(), config=tutconf)