On Dec 1, 2007 10:49 AM, Paul Winkler <[EMAIL PROTECTED]> wrote:
> On Sat, Dec 01, 2007 at 02:34:49AM +0800, Yuan HOng wrote:
> > Hi,
> > It seems that I can not get list attribute of an persistent object
> > changed. I have the following class, which has a list as one of its
> > attributes:
> > class Cart(Persistent):
> > items = 
> > amount = 0
> I hope that's not your actual code. Note here that items is a mutable
> class attribute, so if you do this:
> cart = Cart()
> ... you've just mutated the default list for all instances. Is that
> really what you want? ZODB persistence can only store instance
> attributes, not class attributes.
> But that's irrelevant to the rest of your examples, because you
> re-assigned cart.items, which should work. I don't know what's wrong
I found out now that using PersistentList does solve the problem. I my
previous try I overwrote the empty persistent list with a normal list,
so the test failed.
But using _p_changed on a normal list seems to no longer be useful.
Zope3-users mailing list