InstallationDownload FSSession.tgz and untar it in your root Zope directory. Create a directory called FSSession in the var directory , give it the appropriate permissions and restart Zope. UsageCreate an FSSession instance somewhere in your Zope tree where session support is required. The instance will be named FSSession. To use you must first call: <dtml-call FSSession> preferably from your standard_html_header or any other object that has access to FSSession. This will initialize the Session object and register it with Zope's transaction manager. The FSSession object behaves like a python dictionary and it supports all dictionary methods apart from copy, which I think is not applicable in this context. The keys and values of FSSession can be any picklable object, which includes most python objects. See the python library reference for more details about picklable objects. It has the following additional methods:
ExamplesAssuming that you have already made a call to FSSession (for instance in your standard_html_header). Set a simple session variable: <dtml-call "FSSession.set('name','donkey')"> Or a more complex one: <dtml-call "FSSession.set('expensivemethod',expensivemethod())"> If expensivemethod returns a list you can then retrieve it in a future session by: <dtml-in "FSSession['expensivemethod']"> <dtml-var sequence-item> </dtml-in> To create an integer session variable counter which keeps track of how many times a particular user accesses a given page: <dtml-if "FSSession.has_key('counter')"> <dtml-call "FSSession.set('counter',FSSession['counter']+1)"> <dtml-else> <dtml-call "FSSession.set('counter',1)"> </dtml-if> To view the session contents: <dtml-var "_.str(FSSession)"> or directly by using the showSession.py utility: python utilities/showSession.py var/FSSession/<path to session file> A call to: <dtml-var "FSSession.url('http://www.bigdonkey.com/client1)"> will return: http://www.bigdonkey.com/client1?SessionUID=<sessionuid> if the client has cookies disabled, or: http://www.bigdonkey.com/client1 if they are enabled. To iterate over all session keys: <dtml-in "FSSession.keys()"> ... </dtml-in> Making Forms Sticky This is a more complete usage example on how to make input forms
Session Data OrganizationEach session stores its data in an individual file under the var/FSSession directory based on initial creation time. A busy site will quickly create thousands of files and to increase performance the files are distributed in a three level directory hierarchy. The first corresponds to the day of the year (1-365) the second to the hour (0-23) and the third to the minute (0-59). Under the minute directory the session data are stored in files with the sessionUID as the filename. This scheme makes it easy to delete old session data by running a cron job at the required interval and deleting the appropriate entries. You can view the session data directly by using the showSession.py utility in the utilities directory (see Examples).
|
|
Available Releases
Version | Maturity | Platform | Released |
---|---|---|---|
0-4-2 | Development | 2000-08-29 18:16:02 | |
FSSession-0-4-2.tgz (8 K) | All | ||
0-4-0 | Development | 2000-06-29 13:51:42 | |
FSSession-0-4-0.tgz (7 K) | All | ||
0-3-1 | Development | 2000-04-18 10:29:40 | |
FSSession-0-3-1.tgz (7 K) | All | ||
0-3-0 | Development | 2000-03-08 17:09:07 | |
FSSession-0-3-0.tgz (7 K) | All | ||
0.2.3 | Development | 2000-02-25 19:15:22 | |
FSSession-0-2-3.tgz (6 K) | All | ||
0.2.0 | Development | 1999-12-10 13:49:22 | |
FSSession-0-2-0.tgz (5 K) | All | ||
0.1.0 | Development | 1999-11-28 00:48:10 | |
FSSession.tgz (1 K) | All |