Changeset 278
- Timestamp:
- 06/11/05 09:03:43
- Files:
-
- trunk/CHERRYPYTEAM.txt (modified) (1 diff)
- trunk/cherrypy/tutorial/tut10_sessionfilter.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/CHERRYPYTEAM.txt
r229 r278 1 See http://trac.cherrypy.org/ cgi-bin/trac.cgi/wiki/CherryPyTeam1 See http://trac.cherrypy.org/wiki/CherryPyTeam trunk/cherrypy/tutorial/tut10_sessionfilter.py
r275 r278 1 1 """ 2 Tutorial 08 - Sessions 3 4 Storing session data in CherryPy applications is very easy: cpg.request 5 provides a dictionary called sessionMap that represents the session 6 data for the current user. If you use RAM based sessions, you can store 7 any kind of object into that dictionary; otherwise, you are limited to 8 objects that can be pickled. 2 Tutorial 10 - Advanced sessionFilter usage see tut10_sessionfilter.conf 9 3 """ 10 4 … … 23 17 yield '\n</body></html>' 24 18 25 samplePages = ['admin', 'index', 'forum' , 'sqlobject']19 samplePages = ['admin', 'index', 'forum'] 26 20 27 21 def admin(self): … … 47 41 48 42 # Store the new value in the session dictionary 43 # cpg.sessions.sessionMap is available by default 49 44 cpg.sessions.sessionMap['count'] = count 50 45 … … 55 50 index.exposed = True 56 51 52 # these functions do the same as the index but with a different session dictionary 53 def admin(self): 54 adminCount = cpg.sessions.adminSession.get('adminCount', 0) + 1 55 cpg.sessions.adminSession['adminCount'] = adminCount 56 57 key = cpg.sessions.adminSession.key 58 return self.__examplePage('ram', adminCount, self.samplePages, key) 59 60 admin.exposed = True 61 62 def forum(self): 63 forumCount = cpg.sessions.forumSession.get('forumCount', 0) + 1 64 cpg.sessions.forumSession['forumCount'] = forumCount 65 66 key = cpg.sessions.forumSession.key 67 return self.__examplePage('ram', forumCount, self.samplePages, key) 68 forum.exposed=True 69 57 70 cpg.root = HitCounter() 58 71

