[Zope] Persistence Problem

Charlie Reiman creiman@kefta.com
Fri, 16 Aug 2002 09:34:02 -0700


Thanks everyone. This dawned on me as I was on the train riding home. I also
found __setstate__ and __getstate__ if I want to mess with the loading hooks
(I don't).

http://www.zopelabs.com/cookbook/1002251996

The Zope Developer's guide does talk about module variables. But all it says
is:

"Objects stored in modules but not in the ZODB are not persistent and
not-thread safe. In general it's not a good idea to store data (as opposed
to functions, and class definitions) in modules when using ZODB."

This is not helpful, as there are times when this level of storage is
exactly what you want. This paragraph reads as a "Just don't do this,"
paragraph rather than a "You can do this, here's why you'd want to and what
pitfalls to avoid," paragraph. I've seen the same trick in exUserFolder
(although I did not understand why it did that until yesterday).

Also, the dev guide makes no mention of _v_ attributes be thread/connection
specific, which is a dangerous oversight, IMHO.

I've made the appropriate comments to the dev guide online. Thanks for
everyone's help.

Charlie.

> -----Original Message-----
> From: kapil thangavelu [mailto:kthangavelu@earthlink.net]
> Sent: Thursday, August 15, 2002 7:43 PM
> To: Charlie Reiman; zope@zope.org
> Subject: Re: [Zope] Persistence Problem
>
>
> as andy mentioned, _v_  volatile attributes are specific to a
> thread (well,
> technically there specific to the underlying zodb connection).
> they remain
> only as long as the object remains in memory/cache.
>

.......