[Zope] Temporary Folder Content - Session Data

Dmitry Dembinsky dmitry@deluxoft.com
Wed, 28 May 2003 10:56:11 +0200


> However, it seems to be conventional wisdom to store session data 
> containers in temporary folders, as the default session data 
> container 
> is. This of course goes away on a restart.

I have encountered the same problem. Probably my solution will help you:

We use separate session data object for each project.
In my project all files are located under /projects/prj123/.

Here's a recipe:

1. Create Temporary Folder with id 'temp_folder' under /projects/prj123/
2. Create Session Data Manager under /projects/prj123/
  2.1 Set Session Data Manager property "Transient Object Container
Path" to
	"temp_folder/sesion_data"
3. Make sure that the following snippet is executed before any code
manipulating session data:

tf = context.temp_folder
if not hasattr ( tf, 'session_data' ):
  tf.manage_addProduct[ 'Transience' ].constructTransientObjectContainer
( 'session_data', 'Session Data Object' )

(The code may reside in a login script or you may use
__before_traverse__ mechanism)

Regards,
Dmitry