[ZODB-Dev] conflict resolution for PersistentList

Jeremy Hylton jeremy at alum.mit.edu
Mon May 24 08:44:55 EDT 2004


On Fri, 2004-05-21 at 07:22, Diez B. Roggisch wrote:
> I implemented it, but can't work with the passed state. It looks like this:
> 
> >>> print oldState
> {'items': PR(1079757676 ('\x00\x00\x00\x00\x00\x00\x00\x02', <class 
> 'persistent.list.PersistentList'>)), 'name': 'father'}
> 
> 
> I want to iterate over the items-lists and merge them properly. However, I 
> can't access the items as list - its not iterable. The examples I found on 
> the net only deal witht simple integer data fields. What do I have to do to 
> access the state as real objects? Is there a deserialization neccessary?

As a general rule, you need to include all the information needed to
resolve conflicts in a single database record.  If the class represented
by old state has a resolvable conflict that depends on the values in
items, then you would need to design an object that does not use a
separate PersistentList for items.  This necessarily makes your design
more complicated, but you're optimizing performance.

Are you sure that the conflicts you care about are in this parent
object?  Without knowing anything about your application logic, I would
guess that items is modified more often than its parent.  If so, you
need an _p_resolveConflict() method on items, not on the parent.  You
could accomplish that by subclassing PersistentList and adding the
_p_resolveConflict method.

Jeremy





More information about the ZODB-Dev mailing list