[Zope-dev] Re: Refresh trashes acquisition

Ross Boylan RossBoylan@stanfordalumni.org
Mon, 29 Jul 2002 14:37:47 -0700


On Mon, Jul 29, 2002 at 07:58:22AM +0100, Toby Dickenson wrote:
> On Saturday 27 Jul 2002 12:32 am, Ross Boylan wrote:
> > On Sat, Jul 27, 2002 at 12:26:04AM +0200, Lennart Regebro wrote:
> > > From: "Ross Boylan" <RossBoylan@stanfordalumni.org>
> > >
> > > > I don't follow that last paragraph.  Does it mean
> > > > 1. acquisition created by a.__of__(b) doesn't survive transactions.
> > >
> > > Correct.
> >
> > Just to be sure I understand: so if c is persistent, and I say
> > c.d = a.__of__(b)
> 
> This is storing an acquisition wrapper as an attribute of c. 
> 
> acquisition wrappers are not persistent. This will raise an exception if you 
> try to store c in ZODB.
> 

I was able to store these things without raising an exception, though
not with the ability to reconstitute them reliably.

My case was, however, subtly different.  a.__of__(b) got put in a
PersistentList, which is essentially [] with a little extra help:
-------------------------------------
# This code is a copy of the Python UserList.py, updated to support
# persistence.

from Persistence import Persistent


class PersistentList (Persistent):

    isAPersistentList = 1
    
    def __init__(self, lst=None):
        if lst is None:
            self.data = []
        else:
            self.data = list(lst)
--------------------------------------

Either this case is different, or it is not the case that attempting
to store and acqusition wrapper raises an exception (in Zope 2.5.1).