[Zope-dev] Fw: [Zope-dev] Storing session objects in a ZODB
Andy McKay
andym@ActiveState.com
Wed, 31 Jan 2001 15:50:27 -0800
> In broader terms, however, you already have a superpickler (the ZODB), you
> might as well use it. ;-)
Oh I agree entirely...
> When I say mapping interface, I just mean that the session data object
looks
> like a dictionary. So:
>
> mystorageobject = mycustomclassthatlookslikeadictionary()
> data = sdm.getSessionData()
> for k,v in data.items():
> mystorageobject[k] = v
> afolder._setObject('anid', mystorageobject)
>
> Will do the right thing.
Ah that's too easy. This is a useful little class actually, it maps the
session objects properties to class properties etc then reads them back out
again. Pickling seemed much easier but I agree with the reasons not to...
Thanks works like a charm now...
Cheers.