[Zope-dev] Caching problems

Carlos Neves cneves@ruido-visual.pt
Wed, 16 Aug 2000 17:31:29 +0100


You directly change a nonpersistence participant object.
As stated in
http://www.python.org/workshops/2000-01/proceedings/papers/fulton/zodb3.html :
<quote>
All sub-objects of persistent objects must be persistent or immutable. 
         This rule is necessary because, without it, the persistence system would not be notified of persistent object state changes.
         Like most rules, this rule can be broken with care, as is done in the issue tracking system. A persistent object can use mutable non-persistent
         sub-objects if it notifies the persistence system that the sub-object has changed. It can do this in two ways. It can notify the persistence system
         directly by assigning a true value to the attribute _p_changed
</quote>

so what I think you need is to tell the object wich has the list property that
it has changed, coz he can't know it by himself if you list.append or
list.extend or even list[0] = something. To do this you can:
  1- set self._p_changed = 1 on the object after the change (append or
something)
  2 - assign self.list to itself so that the object knows a change has been
made to that property.

but mainly... RTFM ;-)

On Wed, 16 Aug 2000, Bob Pepin wrote:
> 
> Hi,
> I have a problem with a class I wrote where I have a list as an
> attribute of the class. When I append something to that list, it stays
> there at first, but only until I restart Zope. It disappears (==is set
> to the value I assigned to it in __init__) and reappears as well when
> I hit reload a few times very quickly. Whenever I flush the cache it
> disappears immediately. There seems to be no transaction registered by
> Zope, because it doesn't show up under 'Undo'. I observed this both
> thru a dtml page and a debugging function written in python.
> 
> I attached the code below, the method and attributes I'm talking about
> are IEEShare.read_access_roles, IEEShare.write_access_roles and
> IEEShare.add_user_access()
> 
> The problem exists with both Zope 2.2.0 and 2.2.1b1. I'm running
> 2.2.1b1 right now on a SuSE Linux 6.4 default installation. (standard libc,
> threads etc.) 
> Both versions of Zope are compiled from source.
> 

-- 
"Sometimes I think the surest sign that intelligent life exists elsewhere
in the Universe is that none of it has tried to contact us."

Carlos Neves
cneves@ruido-visual.pt