[ZODB-Dev] Storing persistent and non-persistent data together

Eric Mangold teratorn at world-net.net
Sun Dec 5 00:59:18 EST 2004


On Mon, 1 Nov 2004 11:56:49 -0300, Christian Robottom Reis  
<kiko at async.com.br> wrote:

> On Sun, Oct 31, 2004 at 01:22:09PM -0600, Eric Mangold wrote:
>> I have a client-server application. On the server side I have
>> a User class that stores account information (persistent) and also
>> other related things, such as a reference to the client-side
>> of the connection when the client is logged in (network-depndent
>> and thus non-persistent).
>>
>> These things logically go together, and I would like to keep them
>> together inside my User class which I would like to be a sub-class
>> of Persistent.
>
> This has been discussed before on ZODB-dev; essentially, you would need
> to use 'volatile' attributes (like _v_); however, these present problems
> of their own, since they can disappear at certain transaction
> boundaries.

I'm thinking about using my own _p_ attributes for non-persistent data.
Then, I can re-set those _p_ attributes inside __setstate__. My testing
indicates that this will work.

Does anyone see any problems with creating custom _p_ attributes?

-Eric
(Sorry for letting this thread languish for so long)

> There was discussion on this being slightly modified, but I don't think
> anything concrete came out of it.
>
>> Is this possible? If not, what are the alternatives to storing
>> logically related, persistent and non-persistent, references in
>> the context of the ZODB?
>
> I don't know, because it would depend on your application. You could
> just store a global container (BTree, set, etc) that somehow referenced
> your objects and your non-persistent data; the container would not be
> persistent.
>
> Take care,
> --
> Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
>




More information about the ZODB-Dev mailing list