[Zope] CoreSession + Non-undoable databases

Chris McDonough chrism@zope.com
Tue, 9 Oct 2001 13:43:16 -0400


Ugh!  This isn't as easy as it should be.

First of all, you need to get a reasonably-initialized Data.fs made.  You do
this by installing a "scratch" copy of Zope using an alternate storage as
the "main" storage (I recommend Packless Berkeley Storage that ships with
the bsddb3Storage package (http://www.zope.org/Products/bsddb3Storage)).

In other words, install a new "scratch" copy of Zope as if you were going to
use an alternate storage to back the scratch Zope's main ZODB.  Instructions
for doing this exist in each storage package; and for different storages
this involves setting up what's required for that storage -- eg for
PacklessBerkeleyStorage, you need to install and set up Sleepycat's
BerkeleyDB 3.X and the pybsddb module.

Once you've got the required software installed, and the storage is working
under the new "scratch" Zope instance (you can browse objects in the "new"
ZODB), you've almost got the ZODB initialized properly.  To finish, add a
folder within the newly-initialized ZODB named "sessionData".

Then you need to mount this newly-created ZODB within your *real* Zope
instance (you can do away with the "scratch" Zope instance, just keep the
files created by the alternate storage implementation).  External Mount
(http://www.zope.org/Members/hathawsh/ExternalMount) seems to be a
reasonable way to do this.  It's not documented very well, but the idea is
that you create a mount by creating an exmount that returns a ZODB "DB"
object.

For example, to create a new database that returns a Packless-backed
database, you'd:

- install the ExMount product
- add a file to your Extensions folder named "sessionDB" with
  the following contents (the actual semantics below might be
  wrong, it's just an example):

  import ZODB
  def getSessionDB():
       return ZODB.DB.DB(Products.bsddb3Storage.Packless.Packless('session',
'/path/to/packless/files'))

- create an External Mount object in your ZODB
  (choose "Mount via External Method" from the Add list)
  with the options:

  Module: sessionDB
  Function: getSessionDB
  Path: /sessionData

- Click add.  You should now have a mounted database as "sessionData".

- Add an external data container to the mounted database via
  the mgmt interface (e.g. at '/sessionData/sdc')

- point your session data manager at the external data container
  by changing the path to whatever object you created in the
  last step.

That's it.    I've also put up a howto with this content at
http://www.zope.org/Members/mcdonc/HowTos/UseExternalMountWithCST

----- Original Message -----
From: "CJ Kucera" <pez@apocalyptech.com>
To: <zope@zope.org>
Sent: Tuesday, October 09, 2001 1:01 PM
Subject: [Zope] CoreSession + Non-undoable databases


> I'm looking into CoreSessionTracking, and like what I see, but
> I've got a question.
>
> I want to have sessions persist beyond browser shut-off, which
> means I'll need a Session Data Container.  In the docs, it's
> mentioned that the Data Container should be instantiated inside
> a non-undoing database.  Well, I want to keep the undoability
> of the ZODB for most of my site, so how do I mount a
> non-undoable database somewhere in the tree?
>
> I've looked around at zope.org, and I've run into MountedStorage,
> but it seems to be out of date ("need a very recent CVS, the
> 2.2-pre releases aren't good enough," etc), so I'm wondering if
> there's a better way, or at least a Howto somewhere.
>
> Thanks again!
> -CJ
>
> WOW: Rapacious           | A priest advised Voltaire on his death bed to
> apocalyptech.com/wow     |  renounce the devil.  Replied Voltaire, "This
> pez@apocalyptech.com     |              is no time to make new enemies."
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>