Storing session objects in a ZODB
I want to store the session objects (from CoreSessionTracking) in the ZODB so that users can save preferences (set in a Session) and call them back later. Just thinking that the easiest way to something is to pickle it, but pickling it in the ZODB which then pickles it, seems daft. Someone suggested I could just _setObject into the ZODB, but don't I still need to make a class wrapper around this? Has anyone tried this? I couldn't spot anything in the CoreSessionTracking API that obvious... Cheers. -- Andy McKay.
You won't be able to session data objects from the RAM-based container without special treatment in your main storage, because "under the hood" the internal data container uses a mounted RAM-based storage. See the section in the help/CoreSessionTracking.stx file that ships with the release named "Mounted Database-Based Session Data Container/Internal Session Data Container Caveats". The example provided is the desire to store an object defined in your "main" database into session storage, but it works the other way round as well. While what you ask is doable with a little ZODB magic (and possibly without), I'd recommend instead that you just use an "external session data container" (which stores these objects in persistent storage right off the bat) set up with a long timeout, so that when you shut down Zope and bring it back up your session data won't have disappeared. ----- Original Message ----- From: "Andy McKay" <andym@activestate.com> To: <zope-dev@zope.org> Sent: Monday, January 29, 2001 6:19 PM Subject: [Zope-dev] Storing session objects in a ZODB
I want to store the session objects (from CoreSessionTracking) in the ZODB so that users can save preferences (set in a Session) and call them back later. Just thinking that the easiest way to something is to pickle it, but pickling it in the ZODB which then pickles it, seems daft. Someone suggested I could just _setObject into the ZODB, but don't I still need to make a class wrapper around this?
Has anyone tried this? I couldn't spot anything in the CoreSessionTracking API that obvious...
Cheers.
-- Andy McKay.
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
participants (2)
-
Andy McKay -
Chris McDonough