[Zope] CoreSessionTracking: Initializing a new berkeley storage
Randall F. Kern
randy@spoke.net
Sun, 18 Feb 2001 14:16:50 -0800
My goal is robust session storage, using CoreSessionTracking 0.7.
I've got (all running on a single linux box):
ZEO, providing two storages:
1. FileStorage (with the name 'main')
2. BerkelyStorage (named 'session')
Zope 2.3.0:
With a custom_zodb.py file, which uses a ClientStorage to
connect to ZEO using the 'main' storage.
External Method:
Inside the Extensions directory of my Product directory, I've
got a SessionMount.py, with a function that returns a ZODB.DB() on
another ClientStorage talking to the same ZEO but using the 'session'
storage.
Now I try to add an External Method Mount. I give it the module
ZSpoke.SessionMount (my product is named ZSpoke- this seems to work
fine.) I set the function to createSessionDB(), also works. The path
is set to /session_storage.
This results in an error from MountPoint._getMountRoot: "No
'Application' object exists in the mountable database."
So... I started python and made an application object and a
session_storage folder:
Python 1.5.2 (#2, Nov 14 2000, 17:28:06) [GCC egcs-2.91.66
19990314/Linux (egcs- on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import Zope
Applying TransparentFolders patch version 0.3.
>>> from Products.ZSpoke.Extensions.SessionMount import createSessionDB
>>> db =3D createSessionDB()
>>> conn =3D db.open()
>>> root =3D conn.root()
>>> from OFS.Application import Application
>>> app =3D Application()
>>> root['Application'] =3D app
>>> get_transaction().commit()
>>> from OFS.Folder import Folder
>>> folder =3D Folder()
>>> folder.id =3D 'session_storage'
>>> folder.title =3D 'Session Storage'
>>> app._setObject('session_storage', folder)
'session_storage'
>>> get_transaction().commit()
>>> conn.close()
Then I added an External Session Data Container inside the
session_storage folder, and changed my Session Data Manager to use it.
Everything seems to work, but I'm very unsure :)
One small problem I've noticed is the 'Data object timeout value in
minutes' property on the Manage tab of the External Session Data
Container is always 0, even if I try to change it.
Anyone have any ideas, confirmation, I'm stupid, etc?
Thanks!
-Randy